001    /**
002     * Copyright (c) 2000-2012 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 com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
018    import com.liferay.portal.kernel.exception.SystemException;
019    import com.liferay.portal.kernel.json.JSON;
020    import com.liferay.portal.kernel.util.GetterUtil;
021    import com.liferay.portal.kernel.util.ProxyUtil;
022    import com.liferay.portal.kernel.util.StringBundler;
023    import com.liferay.portal.kernel.util.StringPool;
024    import com.liferay.portal.kernel.workflow.WorkflowConstants;
025    import com.liferay.portal.model.CacheModel;
026    import com.liferay.portal.model.impl.BaseModelImpl;
027    import com.liferay.portal.service.ServiceContext;
028    import com.liferay.portal.util.PortalUtil;
029    
030    import com.liferay.portlet.expando.model.ExpandoBridge;
031    import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
032    import com.liferay.portlet.messageboards.model.MBCategory;
033    import com.liferay.portlet.messageboards.model.MBCategoryModel;
034    import com.liferay.portlet.messageboards.model.MBCategorySoap;
035    
036    import java.io.Serializable;
037    
038    import java.sql.Types;
039    
040    import java.util.ArrayList;
041    import java.util.Date;
042    import java.util.HashMap;
043    import java.util.List;
044    import java.util.Map;
045    
046    /**
047     * 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.
048     *
049     * <p>
050     * This implementation and its corresponding interface {@link com.liferay.portlet.messageboards.model.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}.
051     * </p>
052     *
053     * @author Brian Wing Shun Chan
054     * @see MBCategoryImpl
055     * @see com.liferay.portlet.messageboards.model.MBCategory
056     * @see com.liferay.portlet.messageboards.model.MBCategoryModel
057     * @generated
058     */
059    @JSON(strict = true)
060    public class MBCategoryModelImpl extends BaseModelImpl<MBCategory>
061            implements MBCategoryModel {
062            /*
063             * NOTE FOR DEVELOPERS:
064             *
065             * Never modify or reference this class directly. All methods that expect a message boards category model instance should use the {@link com.liferay.portlet.messageboards.model.MBCategory} interface instead.
066             */
067            public static final String TABLE_NAME = "MBCategory";
068            public static final Object[][] TABLE_COLUMNS = {
069                            { "uuid_", Types.VARCHAR },
070                            { "categoryId", Types.BIGINT },
071                            { "groupId", Types.BIGINT },
072                            { "companyId", Types.BIGINT },
073                            { "userId", Types.BIGINT },
074                            { "userName", Types.VARCHAR },
075                            { "createDate", Types.TIMESTAMP },
076                            { "modifiedDate", Types.TIMESTAMP },
077                            { "parentCategoryId", Types.BIGINT },
078                            { "name", Types.VARCHAR },
079                            { "description", Types.VARCHAR },
080                            { "displayStyle", Types.VARCHAR },
081                            { "threadCount", Types.INTEGER },
082                            { "messageCount", Types.INTEGER },
083                            { "lastPostDate", Types.TIMESTAMP },
084                            { "status", Types.INTEGER },
085                            { "statusByUserId", Types.BIGINT },
086                            { "statusByUserName", Types.VARCHAR },
087                            { "statusDate", Types.TIMESTAMP }
088                    };
089            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,status INTEGER,statusByUserId LONG,statusByUserName VARCHAR(75) null,statusDate DATE null)";
090            public static final String TABLE_SQL_DROP = "drop table MBCategory";
091            public static final String ORDER_BY_JPQL = " ORDER BY mbCategory.parentCategoryId ASC, mbCategory.name ASC";
092            public static final String ORDER_BY_SQL = " ORDER BY MBCategory.parentCategoryId ASC, MBCategory.name ASC";
093            public static final String DATA_SOURCE = "liferayDataSource";
094            public static final String SESSION_FACTORY = "liferaySessionFactory";
095            public static final String TX_MANAGER = "liferayTransactionManager";
096            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
097                                    "value.object.entity.cache.enabled.com.liferay.portlet.messageboards.model.MBCategory"),
098                            true);
099            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
100                                    "value.object.finder.cache.enabled.com.liferay.portlet.messageboards.model.MBCategory"),
101                            true);
102            public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
103                                    "value.object.column.bitmask.enabled.com.liferay.portlet.messageboards.model.MBCategory"),
104                            true);
105            public static long COMPANYID_COLUMN_BITMASK = 1L;
106            public static long GROUPID_COLUMN_BITMASK = 2L;
107            public static long PARENTCATEGORYID_COLUMN_BITMASK = 4L;
108            public static long STATUS_COLUMN_BITMASK = 8L;
109            public static long UUID_COLUMN_BITMASK = 16L;
110            public static long NAME_COLUMN_BITMASK = 32L;
111    
112            /**
113             * Converts the soap model instance into a normal model instance.
114             *
115             * @param soapModel the soap model instance to convert
116             * @return the normal model instance
117             */
118            public static MBCategory toModel(MBCategorySoap soapModel) {
119                    if (soapModel == null) {
120                            return null;
121                    }
122    
123                    MBCategory model = new MBCategoryImpl();
124    
125                    model.setUuid(soapModel.getUuid());
126                    model.setCategoryId(soapModel.getCategoryId());
127                    model.setGroupId(soapModel.getGroupId());
128                    model.setCompanyId(soapModel.getCompanyId());
129                    model.setUserId(soapModel.getUserId());
130                    model.setUserName(soapModel.getUserName());
131                    model.setCreateDate(soapModel.getCreateDate());
132                    model.setModifiedDate(soapModel.getModifiedDate());
133                    model.setParentCategoryId(soapModel.getParentCategoryId());
134                    model.setName(soapModel.getName());
135                    model.setDescription(soapModel.getDescription());
136                    model.setDisplayStyle(soapModel.getDisplayStyle());
137                    model.setThreadCount(soapModel.getThreadCount());
138                    model.setMessageCount(soapModel.getMessageCount());
139                    model.setLastPostDate(soapModel.getLastPostDate());
140                    model.setStatus(soapModel.getStatus());
141                    model.setStatusByUserId(soapModel.getStatusByUserId());
142                    model.setStatusByUserName(soapModel.getStatusByUserName());
143                    model.setStatusDate(soapModel.getStatusDate());
144    
145                    return model;
146            }
147    
148            /**
149             * Converts the soap model instances into normal model instances.
150             *
151             * @param soapModels the soap model instances to convert
152             * @return the normal model instances
153             */
154            public static List<MBCategory> toModels(MBCategorySoap[] soapModels) {
155                    if (soapModels == null) {
156                            return null;
157                    }
158    
159                    List<MBCategory> models = new ArrayList<MBCategory>(soapModels.length);
160    
161                    for (MBCategorySoap soapModel : soapModels) {
162                            models.add(toModel(soapModel));
163                    }
164    
165                    return models;
166            }
167    
168            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
169                                    "lock.expiration.time.com.liferay.portlet.messageboards.model.MBCategory"));
170    
171            public MBCategoryModelImpl() {
172            }
173    
174            public long getPrimaryKey() {
175                    return _categoryId;
176            }
177    
178            public void setPrimaryKey(long primaryKey) {
179                    setCategoryId(primaryKey);
180            }
181    
182            public Serializable getPrimaryKeyObj() {
183                    return new Long(_categoryId);
184            }
185    
186            public void setPrimaryKeyObj(Serializable primaryKeyObj) {
187                    setPrimaryKey(((Long)primaryKeyObj).longValue());
188            }
189    
190            public Class<?> getModelClass() {
191                    return MBCategory.class;
192            }
193    
194            public String getModelClassName() {
195                    return MBCategory.class.getName();
196            }
197    
198            @Override
199            public Map<String, Object> getModelAttributes() {
200                    Map<String, Object> attributes = new HashMap<String, Object>();
201    
202                    attributes.put("uuid", getUuid());
203                    attributes.put("categoryId", getCategoryId());
204                    attributes.put("groupId", getGroupId());
205                    attributes.put("companyId", getCompanyId());
206                    attributes.put("userId", getUserId());
207                    attributes.put("userName", getUserName());
208                    attributes.put("createDate", getCreateDate());
209                    attributes.put("modifiedDate", getModifiedDate());
210                    attributes.put("parentCategoryId", getParentCategoryId());
211                    attributes.put("name", getName());
212                    attributes.put("description", getDescription());
213                    attributes.put("displayStyle", getDisplayStyle());
214                    attributes.put("threadCount", getThreadCount());
215                    attributes.put("messageCount", getMessageCount());
216                    attributes.put("lastPostDate", getLastPostDate());
217                    attributes.put("status", getStatus());
218                    attributes.put("statusByUserId", getStatusByUserId());
219                    attributes.put("statusByUserName", getStatusByUserName());
220                    attributes.put("statusDate", getStatusDate());
221    
222                    return attributes;
223            }
224    
225            @Override
226            public void setModelAttributes(Map<String, Object> attributes) {
227                    String uuid = (String)attributes.get("uuid");
228    
229                    if (uuid != null) {
230                            setUuid(uuid);
231                    }
232    
233                    Long categoryId = (Long)attributes.get("categoryId");
234    
235                    if (categoryId != null) {
236                            setCategoryId(categoryId);
237                    }
238    
239                    Long groupId = (Long)attributes.get("groupId");
240    
241                    if (groupId != null) {
242                            setGroupId(groupId);
243                    }
244    
245                    Long companyId = (Long)attributes.get("companyId");
246    
247                    if (companyId != null) {
248                            setCompanyId(companyId);
249                    }
250    
251                    Long userId = (Long)attributes.get("userId");
252    
253                    if (userId != null) {
254                            setUserId(userId);
255                    }
256    
257                    String userName = (String)attributes.get("userName");
258    
259                    if (userName != null) {
260                            setUserName(userName);
261                    }
262    
263                    Date createDate = (Date)attributes.get("createDate");
264    
265                    if (createDate != null) {
266                            setCreateDate(createDate);
267                    }
268    
269                    Date modifiedDate = (Date)attributes.get("modifiedDate");
270    
271                    if (modifiedDate != null) {
272                            setModifiedDate(modifiedDate);
273                    }
274    
275                    Long parentCategoryId = (Long)attributes.get("parentCategoryId");
276    
277                    if (parentCategoryId != null) {
278                            setParentCategoryId(parentCategoryId);
279                    }
280    
281                    String name = (String)attributes.get("name");
282    
283                    if (name != null) {
284                            setName(name);
285                    }
286    
287                    String description = (String)attributes.get("description");
288    
289                    if (description != null) {
290                            setDescription(description);
291                    }
292    
293                    String displayStyle = (String)attributes.get("displayStyle");
294    
295                    if (displayStyle != null) {
296                            setDisplayStyle(displayStyle);
297                    }
298    
299                    Integer threadCount = (Integer)attributes.get("threadCount");
300    
301                    if (threadCount != null) {
302                            setThreadCount(threadCount);
303                    }
304    
305                    Integer messageCount = (Integer)attributes.get("messageCount");
306    
307                    if (messageCount != null) {
308                            setMessageCount(messageCount);
309                    }
310    
311                    Date lastPostDate = (Date)attributes.get("lastPostDate");
312    
313                    if (lastPostDate != null) {
314                            setLastPostDate(lastPostDate);
315                    }
316    
317                    Integer status = (Integer)attributes.get("status");
318    
319                    if (status != null) {
320                            setStatus(status);
321                    }
322    
323                    Long statusByUserId = (Long)attributes.get("statusByUserId");
324    
325                    if (statusByUserId != null) {
326                            setStatusByUserId(statusByUserId);
327                    }
328    
329                    String statusByUserName = (String)attributes.get("statusByUserName");
330    
331                    if (statusByUserName != null) {
332                            setStatusByUserName(statusByUserName);
333                    }
334    
335                    Date statusDate = (Date)attributes.get("statusDate");
336    
337                    if (statusDate != null) {
338                            setStatusDate(statusDate);
339                    }
340            }
341    
342            @JSON
343            public String getUuid() {
344                    if (_uuid == null) {
345                            return StringPool.BLANK;
346                    }
347                    else {
348                            return _uuid;
349                    }
350            }
351    
352            public void setUuid(String uuid) {
353                    if (_originalUuid == null) {
354                            _originalUuid = _uuid;
355                    }
356    
357                    _uuid = uuid;
358            }
359    
360            public String getOriginalUuid() {
361                    return GetterUtil.getString(_originalUuid);
362            }
363    
364            @JSON
365            public long getCategoryId() {
366                    return _categoryId;
367            }
368    
369            public void setCategoryId(long categoryId) {
370                    _categoryId = categoryId;
371            }
372    
373            @JSON
374            public long getGroupId() {
375                    return _groupId;
376            }
377    
378            public void setGroupId(long groupId) {
379                    _columnBitmask |= GROUPID_COLUMN_BITMASK;
380    
381                    if (!_setOriginalGroupId) {
382                            _setOriginalGroupId = true;
383    
384                            _originalGroupId = _groupId;
385                    }
386    
387                    _groupId = groupId;
388            }
389    
390            public long getOriginalGroupId() {
391                    return _originalGroupId;
392            }
393    
394            @JSON
395            public long getCompanyId() {
396                    return _companyId;
397            }
398    
399            public void setCompanyId(long companyId) {
400                    _columnBitmask |= COMPANYID_COLUMN_BITMASK;
401    
402                    if (!_setOriginalCompanyId) {
403                            _setOriginalCompanyId = true;
404    
405                            _originalCompanyId = _companyId;
406                    }
407    
408                    _companyId = companyId;
409            }
410    
411            public long getOriginalCompanyId() {
412                    return _originalCompanyId;
413            }
414    
415            @JSON
416            public long getUserId() {
417                    return _userId;
418            }
419    
420            public void setUserId(long userId) {
421                    _userId = userId;
422            }
423    
424            public String getUserUuid() throws SystemException {
425                    return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
426            }
427    
428            public void setUserUuid(String userUuid) {
429                    _userUuid = userUuid;
430            }
431    
432            @JSON
433            public String getUserName() {
434                    if (_userName == null) {
435                            return StringPool.BLANK;
436                    }
437                    else {
438                            return _userName;
439                    }
440            }
441    
442            public void setUserName(String userName) {
443                    _userName = userName;
444            }
445    
446            @JSON
447            public Date getCreateDate() {
448                    return _createDate;
449            }
450    
451            public void setCreateDate(Date createDate) {
452                    _createDate = createDate;
453            }
454    
455            @JSON
456            public Date getModifiedDate() {
457                    return _modifiedDate;
458            }
459    
460            public void setModifiedDate(Date modifiedDate) {
461                    _modifiedDate = modifiedDate;
462            }
463    
464            @JSON
465            public long getParentCategoryId() {
466                    return _parentCategoryId;
467            }
468    
469            public void setParentCategoryId(long parentCategoryId) {
470                    _columnBitmask = -1L;
471    
472                    if (!_setOriginalParentCategoryId) {
473                            _setOriginalParentCategoryId = true;
474    
475                            _originalParentCategoryId = _parentCategoryId;
476                    }
477    
478                    _parentCategoryId = parentCategoryId;
479            }
480    
481            public long getOriginalParentCategoryId() {
482                    return _originalParentCategoryId;
483            }
484    
485            @JSON
486            public String getName() {
487                    if (_name == null) {
488                            return StringPool.BLANK;
489                    }
490                    else {
491                            return _name;
492                    }
493            }
494    
495            public void setName(String name) {
496                    _columnBitmask = -1L;
497    
498                    _name = name;
499            }
500    
501            @JSON
502            public String getDescription() {
503                    if (_description == null) {
504                            return StringPool.BLANK;
505                    }
506                    else {
507                            return _description;
508                    }
509            }
510    
511            public void setDescription(String description) {
512                    _description = description;
513            }
514    
515            @JSON
516            public String getDisplayStyle() {
517                    if (_displayStyle == null) {
518                            return StringPool.BLANK;
519                    }
520                    else {
521                            return _displayStyle;
522                    }
523            }
524    
525            public void setDisplayStyle(String displayStyle) {
526                    _displayStyle = displayStyle;
527            }
528    
529            @JSON
530            public int getThreadCount() {
531                    return _threadCount;
532            }
533    
534            public void setThreadCount(int threadCount) {
535                    _threadCount = threadCount;
536            }
537    
538            @JSON
539            public int getMessageCount() {
540                    return _messageCount;
541            }
542    
543            public void setMessageCount(int messageCount) {
544                    _messageCount = messageCount;
545            }
546    
547            @JSON
548            public Date getLastPostDate() {
549                    return _lastPostDate;
550            }
551    
552            public void setLastPostDate(Date lastPostDate) {
553                    _lastPostDate = lastPostDate;
554            }
555    
556            @JSON
557            public int getStatus() {
558                    return _status;
559            }
560    
561            public void setStatus(int status) {
562                    _columnBitmask |= STATUS_COLUMN_BITMASK;
563    
564                    if (!_setOriginalStatus) {
565                            _setOriginalStatus = true;
566    
567                            _originalStatus = _status;
568                    }
569    
570                    _status = status;
571            }
572    
573            public int getOriginalStatus() {
574                    return _originalStatus;
575            }
576    
577            @JSON
578            public long getStatusByUserId() {
579                    return _statusByUserId;
580            }
581    
582            public void setStatusByUserId(long statusByUserId) {
583                    _statusByUserId = statusByUserId;
584            }
585    
586            public String getStatusByUserUuid() throws SystemException {
587                    return PortalUtil.getUserValue(getStatusByUserId(), "uuid",
588                            _statusByUserUuid);
589            }
590    
591            public void setStatusByUserUuid(String statusByUserUuid) {
592                    _statusByUserUuid = statusByUserUuid;
593            }
594    
595            @JSON
596            public String getStatusByUserName() {
597                    if (_statusByUserName == null) {
598                            return StringPool.BLANK;
599                    }
600                    else {
601                            return _statusByUserName;
602                    }
603            }
604    
605            public void setStatusByUserName(String statusByUserName) {
606                    _statusByUserName = statusByUserName;
607            }
608    
609            @JSON
610            public Date getStatusDate() {
611                    return _statusDate;
612            }
613    
614            public void setStatusDate(Date statusDate) {
615                    _statusDate = statusDate;
616            }
617    
618            public long getContainerModelId() {
619                    return getCategoryId();
620            }
621    
622            public void setContainerModelId(long containerModelId) {
623                    _categoryId = containerModelId;
624            }
625    
626            public long getParentContainerModelId() {
627                    return getParentCategoryId();
628            }
629    
630            public void setParentContainerModelId(long parentContainerModelId) {
631                    _parentCategoryId = parentContainerModelId;
632            }
633    
634            public String getContainerModelName() {
635                    return String.valueOf(getName());
636            }
637    
638            /**
639             * @deprecated {@link #isApproved}
640             */
641            public boolean getApproved() {
642                    return isApproved();
643            }
644    
645            public boolean isApproved() {
646                    if (getStatus() == WorkflowConstants.STATUS_APPROVED) {
647                            return true;
648                    }
649                    else {
650                            return false;
651                    }
652            }
653    
654            public boolean isDenied() {
655                    if (getStatus() == WorkflowConstants.STATUS_DENIED) {
656                            return true;
657                    }
658                    else {
659                            return false;
660                    }
661            }
662    
663            public boolean isDraft() {
664                    if (getStatus() == WorkflowConstants.STATUS_DRAFT) {
665                            return true;
666                    }
667                    else {
668                            return false;
669                    }
670            }
671    
672            public boolean isExpired() {
673                    if (getStatus() == WorkflowConstants.STATUS_EXPIRED) {
674                            return true;
675                    }
676                    else {
677                            return false;
678                    }
679            }
680    
681            public boolean isInactive() {
682                    if (getStatus() == WorkflowConstants.STATUS_INACTIVE) {
683                            return true;
684                    }
685                    else {
686                            return false;
687                    }
688            }
689    
690            public boolean isIncomplete() {
691                    if (getStatus() == WorkflowConstants.STATUS_INCOMPLETE) {
692                            return true;
693                    }
694                    else {
695                            return false;
696                    }
697            }
698    
699            public boolean isInTrash() {
700                    if (getStatus() == WorkflowConstants.STATUS_IN_TRASH) {
701                            return true;
702                    }
703                    else {
704                            return false;
705                    }
706            }
707    
708            public boolean isPending() {
709                    if (getStatus() == WorkflowConstants.STATUS_PENDING) {
710                            return true;
711                    }
712                    else {
713                            return false;
714                    }
715            }
716    
717            public boolean isScheduled() {
718                    if (getStatus() == WorkflowConstants.STATUS_SCHEDULED) {
719                            return true;
720                    }
721                    else {
722                            return false;
723                    }
724            }
725    
726            public long getColumnBitmask() {
727                    return _columnBitmask;
728            }
729    
730            @Override
731            public ExpandoBridge getExpandoBridge() {
732                    return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
733                            MBCategory.class.getName(), getPrimaryKey());
734            }
735    
736            @Override
737            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
738                    ExpandoBridge expandoBridge = getExpandoBridge();
739    
740                    expandoBridge.setAttributes(serviceContext);
741            }
742    
743            @Override
744            public MBCategory toEscapedModel() {
745                    if (_escapedModel == null) {
746                            _escapedModel = (MBCategory)ProxyUtil.newProxyInstance(_classLoader,
747                                            _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
748                    }
749    
750                    return _escapedModel;
751            }
752    
753            @Override
754            public Object clone() {
755                    MBCategoryImpl mbCategoryImpl = new MBCategoryImpl();
756    
757                    mbCategoryImpl.setUuid(getUuid());
758                    mbCategoryImpl.setCategoryId(getCategoryId());
759                    mbCategoryImpl.setGroupId(getGroupId());
760                    mbCategoryImpl.setCompanyId(getCompanyId());
761                    mbCategoryImpl.setUserId(getUserId());
762                    mbCategoryImpl.setUserName(getUserName());
763                    mbCategoryImpl.setCreateDate(getCreateDate());
764                    mbCategoryImpl.setModifiedDate(getModifiedDate());
765                    mbCategoryImpl.setParentCategoryId(getParentCategoryId());
766                    mbCategoryImpl.setName(getName());
767                    mbCategoryImpl.setDescription(getDescription());
768                    mbCategoryImpl.setDisplayStyle(getDisplayStyle());
769                    mbCategoryImpl.setThreadCount(getThreadCount());
770                    mbCategoryImpl.setMessageCount(getMessageCount());
771                    mbCategoryImpl.setLastPostDate(getLastPostDate());
772                    mbCategoryImpl.setStatus(getStatus());
773                    mbCategoryImpl.setStatusByUserId(getStatusByUserId());
774                    mbCategoryImpl.setStatusByUserName(getStatusByUserName());
775                    mbCategoryImpl.setStatusDate(getStatusDate());
776    
777                    mbCategoryImpl.resetOriginalValues();
778    
779                    return mbCategoryImpl;
780            }
781    
782            public int compareTo(MBCategory mbCategory) {
783                    int value = 0;
784    
785                    if (getParentCategoryId() < mbCategory.getParentCategoryId()) {
786                            value = -1;
787                    }
788                    else if (getParentCategoryId() > mbCategory.getParentCategoryId()) {
789                            value = 1;
790                    }
791                    else {
792                            value = 0;
793                    }
794    
795                    if (value != 0) {
796                            return value;
797                    }
798    
799                    value = getName().toLowerCase()
800                                            .compareTo(mbCategory.getName().toLowerCase());
801    
802                    if (value != 0) {
803                            return value;
804                    }
805    
806                    return 0;
807            }
808    
809            @Override
810            public boolean equals(Object obj) {
811                    if (obj == null) {
812                            return false;
813                    }
814    
815                    MBCategory mbCategory = null;
816    
817                    try {
818                            mbCategory = (MBCategory)obj;
819                    }
820                    catch (ClassCastException cce) {
821                            return false;
822                    }
823    
824                    long primaryKey = mbCategory.getPrimaryKey();
825    
826                    if (getPrimaryKey() == primaryKey) {
827                            return true;
828                    }
829                    else {
830                            return false;
831                    }
832            }
833    
834            @Override
835            public int hashCode() {
836                    return (int)getPrimaryKey();
837            }
838    
839            @Override
840            public void resetOriginalValues() {
841                    MBCategoryModelImpl mbCategoryModelImpl = this;
842    
843                    mbCategoryModelImpl._originalUuid = mbCategoryModelImpl._uuid;
844    
845                    mbCategoryModelImpl._originalGroupId = mbCategoryModelImpl._groupId;
846    
847                    mbCategoryModelImpl._setOriginalGroupId = false;
848    
849                    mbCategoryModelImpl._originalCompanyId = mbCategoryModelImpl._companyId;
850    
851                    mbCategoryModelImpl._setOriginalCompanyId = false;
852    
853                    mbCategoryModelImpl._originalParentCategoryId = mbCategoryModelImpl._parentCategoryId;
854    
855                    mbCategoryModelImpl._setOriginalParentCategoryId = false;
856    
857                    mbCategoryModelImpl._originalStatus = mbCategoryModelImpl._status;
858    
859                    mbCategoryModelImpl._setOriginalStatus = false;
860    
861                    mbCategoryModelImpl._columnBitmask = 0;
862            }
863    
864            @Override
865            public CacheModel<MBCategory> toCacheModel() {
866                    MBCategoryCacheModel mbCategoryCacheModel = new MBCategoryCacheModel();
867    
868                    mbCategoryCacheModel.uuid = getUuid();
869    
870                    String uuid = mbCategoryCacheModel.uuid;
871    
872                    if ((uuid != null) && (uuid.length() == 0)) {
873                            mbCategoryCacheModel.uuid = null;
874                    }
875    
876                    mbCategoryCacheModel.categoryId = getCategoryId();
877    
878                    mbCategoryCacheModel.groupId = getGroupId();
879    
880                    mbCategoryCacheModel.companyId = getCompanyId();
881    
882                    mbCategoryCacheModel.userId = getUserId();
883    
884                    mbCategoryCacheModel.userName = getUserName();
885    
886                    String userName = mbCategoryCacheModel.userName;
887    
888                    if ((userName != null) && (userName.length() == 0)) {
889                            mbCategoryCacheModel.userName = null;
890                    }
891    
892                    Date createDate = getCreateDate();
893    
894                    if (createDate != null) {
895                            mbCategoryCacheModel.createDate = createDate.getTime();
896                    }
897                    else {
898                            mbCategoryCacheModel.createDate = Long.MIN_VALUE;
899                    }
900    
901                    Date modifiedDate = getModifiedDate();
902    
903                    if (modifiedDate != null) {
904                            mbCategoryCacheModel.modifiedDate = modifiedDate.getTime();
905                    }
906                    else {
907                            mbCategoryCacheModel.modifiedDate = Long.MIN_VALUE;
908                    }
909    
910                    mbCategoryCacheModel.parentCategoryId = getParentCategoryId();
911    
912                    mbCategoryCacheModel.name = getName();
913    
914                    String name = mbCategoryCacheModel.name;
915    
916                    if ((name != null) && (name.length() == 0)) {
917                            mbCategoryCacheModel.name = null;
918                    }
919    
920                    mbCategoryCacheModel.description = getDescription();
921    
922                    String description = mbCategoryCacheModel.description;
923    
924                    if ((description != null) && (description.length() == 0)) {
925                            mbCategoryCacheModel.description = null;
926                    }
927    
928                    mbCategoryCacheModel.displayStyle = getDisplayStyle();
929    
930                    String displayStyle = mbCategoryCacheModel.displayStyle;
931    
932                    if ((displayStyle != null) && (displayStyle.length() == 0)) {
933                            mbCategoryCacheModel.displayStyle = null;
934                    }
935    
936                    mbCategoryCacheModel.threadCount = getThreadCount();
937    
938                    mbCategoryCacheModel.messageCount = getMessageCount();
939    
940                    Date lastPostDate = getLastPostDate();
941    
942                    if (lastPostDate != null) {
943                            mbCategoryCacheModel.lastPostDate = lastPostDate.getTime();
944                    }
945                    else {
946                            mbCategoryCacheModel.lastPostDate = Long.MIN_VALUE;
947                    }
948    
949                    mbCategoryCacheModel.status = getStatus();
950    
951                    mbCategoryCacheModel.statusByUserId = getStatusByUserId();
952    
953                    mbCategoryCacheModel.statusByUserName = getStatusByUserName();
954    
955                    String statusByUserName = mbCategoryCacheModel.statusByUserName;
956    
957                    if ((statusByUserName != null) && (statusByUserName.length() == 0)) {
958                            mbCategoryCacheModel.statusByUserName = null;
959                    }
960    
961                    Date statusDate = getStatusDate();
962    
963                    if (statusDate != null) {
964                            mbCategoryCacheModel.statusDate = statusDate.getTime();
965                    }
966                    else {
967                            mbCategoryCacheModel.statusDate = Long.MIN_VALUE;
968                    }
969    
970                    return mbCategoryCacheModel;
971            }
972    
973            @Override
974            public String toString() {
975                    StringBundler sb = new StringBundler(39);
976    
977                    sb.append("{uuid=");
978                    sb.append(getUuid());
979                    sb.append(", categoryId=");
980                    sb.append(getCategoryId());
981                    sb.append(", groupId=");
982                    sb.append(getGroupId());
983                    sb.append(", companyId=");
984                    sb.append(getCompanyId());
985                    sb.append(", userId=");
986                    sb.append(getUserId());
987                    sb.append(", userName=");
988                    sb.append(getUserName());
989                    sb.append(", createDate=");
990                    sb.append(getCreateDate());
991                    sb.append(", modifiedDate=");
992                    sb.append(getModifiedDate());
993                    sb.append(", parentCategoryId=");
994                    sb.append(getParentCategoryId());
995                    sb.append(", name=");
996                    sb.append(getName());
997                    sb.append(", description=");
998                    sb.append(getDescription());
999                    sb.append(", displayStyle=");
1000                    sb.append(getDisplayStyle());
1001                    sb.append(", threadCount=");
1002                    sb.append(getThreadCount());
1003                    sb.append(", messageCount=");
1004                    sb.append(getMessageCount());
1005                    sb.append(", lastPostDate=");
1006                    sb.append(getLastPostDate());
1007                    sb.append(", status=");
1008                    sb.append(getStatus());
1009                    sb.append(", statusByUserId=");
1010                    sb.append(getStatusByUserId());
1011                    sb.append(", statusByUserName=");
1012                    sb.append(getStatusByUserName());
1013                    sb.append(", statusDate=");
1014                    sb.append(getStatusDate());
1015                    sb.append("}");
1016    
1017                    return sb.toString();
1018            }
1019    
1020            public String toXmlString() {
1021                    StringBundler sb = new StringBundler(61);
1022    
1023                    sb.append("<model><model-name>");
1024                    sb.append("com.liferay.portlet.messageboards.model.MBCategory");
1025                    sb.append("</model-name>");
1026    
1027                    sb.append(
1028                            "<column><column-name>uuid</column-name><column-value><![CDATA[");
1029                    sb.append(getUuid());
1030                    sb.append("]]></column-value></column>");
1031                    sb.append(
1032                            "<column><column-name>categoryId</column-name><column-value><![CDATA[");
1033                    sb.append(getCategoryId());
1034                    sb.append("]]></column-value></column>");
1035                    sb.append(
1036                            "<column><column-name>groupId</column-name><column-value><![CDATA[");
1037                    sb.append(getGroupId());
1038                    sb.append("]]></column-value></column>");
1039                    sb.append(
1040                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
1041                    sb.append(getCompanyId());
1042                    sb.append("]]></column-value></column>");
1043                    sb.append(
1044                            "<column><column-name>userId</column-name><column-value><![CDATA[");
1045                    sb.append(getUserId());
1046                    sb.append("]]></column-value></column>");
1047                    sb.append(
1048                            "<column><column-name>userName</column-name><column-value><![CDATA[");
1049                    sb.append(getUserName());
1050                    sb.append("]]></column-value></column>");
1051                    sb.append(
1052                            "<column><column-name>createDate</column-name><column-value><![CDATA[");
1053                    sb.append(getCreateDate());
1054                    sb.append("]]></column-value></column>");
1055                    sb.append(
1056                            "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
1057                    sb.append(getModifiedDate());
1058                    sb.append("]]></column-value></column>");
1059                    sb.append(
1060                            "<column><column-name>parentCategoryId</column-name><column-value><![CDATA[");
1061                    sb.append(getParentCategoryId());
1062                    sb.append("]]></column-value></column>");
1063                    sb.append(
1064                            "<column><column-name>name</column-name><column-value><![CDATA[");
1065                    sb.append(getName());
1066                    sb.append("]]></column-value></column>");
1067                    sb.append(
1068                            "<column><column-name>description</column-name><column-value><![CDATA[");
1069                    sb.append(getDescription());
1070                    sb.append("]]></column-value></column>");
1071                    sb.append(
1072                            "<column><column-name>displayStyle</column-name><column-value><![CDATA[");
1073                    sb.append(getDisplayStyle());
1074                    sb.append("]]></column-value></column>");
1075                    sb.append(
1076                            "<column><column-name>threadCount</column-name><column-value><![CDATA[");
1077                    sb.append(getThreadCount());
1078                    sb.append("]]></column-value></column>");
1079                    sb.append(
1080                            "<column><column-name>messageCount</column-name><column-value><![CDATA[");
1081                    sb.append(getMessageCount());
1082                    sb.append("]]></column-value></column>");
1083                    sb.append(
1084                            "<column><column-name>lastPostDate</column-name><column-value><![CDATA[");
1085                    sb.append(getLastPostDate());
1086                    sb.append("]]></column-value></column>");
1087                    sb.append(
1088                            "<column><column-name>status</column-name><column-value><![CDATA[");
1089                    sb.append(getStatus());
1090                    sb.append("]]></column-value></column>");
1091                    sb.append(
1092                            "<column><column-name>statusByUserId</column-name><column-value><![CDATA[");
1093                    sb.append(getStatusByUserId());
1094                    sb.append("]]></column-value></column>");
1095                    sb.append(
1096                            "<column><column-name>statusByUserName</column-name><column-value><![CDATA[");
1097                    sb.append(getStatusByUserName());
1098                    sb.append("]]></column-value></column>");
1099                    sb.append(
1100                            "<column><column-name>statusDate</column-name><column-value><![CDATA[");
1101                    sb.append(getStatusDate());
1102                    sb.append("]]></column-value></column>");
1103    
1104                    sb.append("</model>");
1105    
1106                    return sb.toString();
1107            }
1108    
1109            private static ClassLoader _classLoader = MBCategory.class.getClassLoader();
1110            private static Class<?>[] _escapedModelInterfaces = new Class[] {
1111                            MBCategory.class
1112                    };
1113            private String _uuid;
1114            private String _originalUuid;
1115            private long _categoryId;
1116            private long _groupId;
1117            private long _originalGroupId;
1118            private boolean _setOriginalGroupId;
1119            private long _companyId;
1120            private long _originalCompanyId;
1121            private boolean _setOriginalCompanyId;
1122            private long _userId;
1123            private String _userUuid;
1124            private String _userName;
1125            private Date _createDate;
1126            private Date _modifiedDate;
1127            private long _parentCategoryId;
1128            private long _originalParentCategoryId;
1129            private boolean _setOriginalParentCategoryId;
1130            private String _name;
1131            private String _description;
1132            private String _displayStyle;
1133            private int _threadCount;
1134            private int _messageCount;
1135            private Date _lastPostDate;
1136            private int _status;
1137            private int _originalStatus;
1138            private boolean _setOriginalStatus;
1139            private long _statusByUserId;
1140            private String _statusByUserUuid;
1141            private String _statusByUserName;
1142            private Date _statusDate;
1143            private long _columnBitmask;
1144            private MBCategory _escapedModel;
1145    }