001    /**
002     * Copyright (c) 2000-2013 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 _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 As of 6.1.0, replaced by {@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().compareToIgnoreCase(mbCategory.getName());
800    
801                    if (value != 0) {
802                            return value;
803                    }
804    
805                    return 0;
806            }
807    
808            @Override
809            public boolean equals(Object obj) {
810                    if (obj == null) {
811                            return false;
812                    }
813    
814                    MBCategory mbCategory = null;
815    
816                    try {
817                            mbCategory = (MBCategory)obj;
818                    }
819                    catch (ClassCastException cce) {
820                            return false;
821                    }
822    
823                    long primaryKey = mbCategory.getPrimaryKey();
824    
825                    if (getPrimaryKey() == primaryKey) {
826                            return true;
827                    }
828                    else {
829                            return false;
830                    }
831            }
832    
833            @Override
834            public int hashCode() {
835                    return (int)getPrimaryKey();
836            }
837    
838            @Override
839            public void resetOriginalValues() {
840                    MBCategoryModelImpl mbCategoryModelImpl = this;
841    
842                    mbCategoryModelImpl._originalUuid = mbCategoryModelImpl._uuid;
843    
844                    mbCategoryModelImpl._originalGroupId = mbCategoryModelImpl._groupId;
845    
846                    mbCategoryModelImpl._setOriginalGroupId = false;
847    
848                    mbCategoryModelImpl._originalCompanyId = mbCategoryModelImpl._companyId;
849    
850                    mbCategoryModelImpl._setOriginalCompanyId = false;
851    
852                    mbCategoryModelImpl._originalParentCategoryId = mbCategoryModelImpl._parentCategoryId;
853    
854                    mbCategoryModelImpl._setOriginalParentCategoryId = false;
855    
856                    mbCategoryModelImpl._originalStatus = mbCategoryModelImpl._status;
857    
858                    mbCategoryModelImpl._setOriginalStatus = false;
859    
860                    mbCategoryModelImpl._columnBitmask = 0;
861            }
862    
863            @Override
864            public CacheModel<MBCategory> toCacheModel() {
865                    MBCategoryCacheModel mbCategoryCacheModel = new MBCategoryCacheModel();
866    
867                    mbCategoryCacheModel.uuid = getUuid();
868    
869                    String uuid = mbCategoryCacheModel.uuid;
870    
871                    if ((uuid != null) && (uuid.length() == 0)) {
872                            mbCategoryCacheModel.uuid = null;
873                    }
874    
875                    mbCategoryCacheModel.categoryId = getCategoryId();
876    
877                    mbCategoryCacheModel.groupId = getGroupId();
878    
879                    mbCategoryCacheModel.companyId = getCompanyId();
880    
881                    mbCategoryCacheModel.userId = getUserId();
882    
883                    mbCategoryCacheModel.userName = getUserName();
884    
885                    String userName = mbCategoryCacheModel.userName;
886    
887                    if ((userName != null) && (userName.length() == 0)) {
888                            mbCategoryCacheModel.userName = null;
889                    }
890    
891                    Date createDate = getCreateDate();
892    
893                    if (createDate != null) {
894                            mbCategoryCacheModel.createDate = createDate.getTime();
895                    }
896                    else {
897                            mbCategoryCacheModel.createDate = Long.MIN_VALUE;
898                    }
899    
900                    Date modifiedDate = getModifiedDate();
901    
902                    if (modifiedDate != null) {
903                            mbCategoryCacheModel.modifiedDate = modifiedDate.getTime();
904                    }
905                    else {
906                            mbCategoryCacheModel.modifiedDate = Long.MIN_VALUE;
907                    }
908    
909                    mbCategoryCacheModel.parentCategoryId = getParentCategoryId();
910    
911                    mbCategoryCacheModel.name = getName();
912    
913                    String name = mbCategoryCacheModel.name;
914    
915                    if ((name != null) && (name.length() == 0)) {
916                            mbCategoryCacheModel.name = null;
917                    }
918    
919                    mbCategoryCacheModel.description = getDescription();
920    
921                    String description = mbCategoryCacheModel.description;
922    
923                    if ((description != null) && (description.length() == 0)) {
924                            mbCategoryCacheModel.description = null;
925                    }
926    
927                    mbCategoryCacheModel.displayStyle = getDisplayStyle();
928    
929                    String displayStyle = mbCategoryCacheModel.displayStyle;
930    
931                    if ((displayStyle != null) && (displayStyle.length() == 0)) {
932                            mbCategoryCacheModel.displayStyle = null;
933                    }
934    
935                    mbCategoryCacheModel.threadCount = getThreadCount();
936    
937                    mbCategoryCacheModel.messageCount = getMessageCount();
938    
939                    Date lastPostDate = getLastPostDate();
940    
941                    if (lastPostDate != null) {
942                            mbCategoryCacheModel.lastPostDate = lastPostDate.getTime();
943                    }
944                    else {
945                            mbCategoryCacheModel.lastPostDate = Long.MIN_VALUE;
946                    }
947    
948                    mbCategoryCacheModel.status = getStatus();
949    
950                    mbCategoryCacheModel.statusByUserId = getStatusByUserId();
951    
952                    mbCategoryCacheModel.statusByUserName = getStatusByUserName();
953    
954                    String statusByUserName = mbCategoryCacheModel.statusByUserName;
955    
956                    if ((statusByUserName != null) && (statusByUserName.length() == 0)) {
957                            mbCategoryCacheModel.statusByUserName = null;
958                    }
959    
960                    Date statusDate = getStatusDate();
961    
962                    if (statusDate != null) {
963                            mbCategoryCacheModel.statusDate = statusDate.getTime();
964                    }
965                    else {
966                            mbCategoryCacheModel.statusDate = Long.MIN_VALUE;
967                    }
968    
969                    return mbCategoryCacheModel;
970            }
971    
972            @Override
973            public String toString() {
974                    StringBundler sb = new StringBundler(39);
975    
976                    sb.append("{uuid=");
977                    sb.append(getUuid());
978                    sb.append(", categoryId=");
979                    sb.append(getCategoryId());
980                    sb.append(", groupId=");
981                    sb.append(getGroupId());
982                    sb.append(", companyId=");
983                    sb.append(getCompanyId());
984                    sb.append(", userId=");
985                    sb.append(getUserId());
986                    sb.append(", userName=");
987                    sb.append(getUserName());
988                    sb.append(", createDate=");
989                    sb.append(getCreateDate());
990                    sb.append(", modifiedDate=");
991                    sb.append(getModifiedDate());
992                    sb.append(", parentCategoryId=");
993                    sb.append(getParentCategoryId());
994                    sb.append(", name=");
995                    sb.append(getName());
996                    sb.append(", description=");
997                    sb.append(getDescription());
998                    sb.append(", displayStyle=");
999                    sb.append(getDisplayStyle());
1000                    sb.append(", threadCount=");
1001                    sb.append(getThreadCount());
1002                    sb.append(", messageCount=");
1003                    sb.append(getMessageCount());
1004                    sb.append(", lastPostDate=");
1005                    sb.append(getLastPostDate());
1006                    sb.append(", status=");
1007                    sb.append(getStatus());
1008                    sb.append(", statusByUserId=");
1009                    sb.append(getStatusByUserId());
1010                    sb.append(", statusByUserName=");
1011                    sb.append(getStatusByUserName());
1012                    sb.append(", statusDate=");
1013                    sb.append(getStatusDate());
1014                    sb.append("}");
1015    
1016                    return sb.toString();
1017            }
1018    
1019            public String toXmlString() {
1020                    StringBundler sb = new StringBundler(61);
1021    
1022                    sb.append("<model><model-name>");
1023                    sb.append("com.liferay.portlet.messageboards.model.MBCategory");
1024                    sb.append("</model-name>");
1025    
1026                    sb.append(
1027                            "<column><column-name>uuid</column-name><column-value><![CDATA[");
1028                    sb.append(getUuid());
1029                    sb.append("]]></column-value></column>");
1030                    sb.append(
1031                            "<column><column-name>categoryId</column-name><column-value><![CDATA[");
1032                    sb.append(getCategoryId());
1033                    sb.append("]]></column-value></column>");
1034                    sb.append(
1035                            "<column><column-name>groupId</column-name><column-value><![CDATA[");
1036                    sb.append(getGroupId());
1037                    sb.append("]]></column-value></column>");
1038                    sb.append(
1039                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
1040                    sb.append(getCompanyId());
1041                    sb.append("]]></column-value></column>");
1042                    sb.append(
1043                            "<column><column-name>userId</column-name><column-value><![CDATA[");
1044                    sb.append(getUserId());
1045                    sb.append("]]></column-value></column>");
1046                    sb.append(
1047                            "<column><column-name>userName</column-name><column-value><![CDATA[");
1048                    sb.append(getUserName());
1049                    sb.append("]]></column-value></column>");
1050                    sb.append(
1051                            "<column><column-name>createDate</column-name><column-value><![CDATA[");
1052                    sb.append(getCreateDate());
1053                    sb.append("]]></column-value></column>");
1054                    sb.append(
1055                            "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
1056                    sb.append(getModifiedDate());
1057                    sb.append("]]></column-value></column>");
1058                    sb.append(
1059                            "<column><column-name>parentCategoryId</column-name><column-value><![CDATA[");
1060                    sb.append(getParentCategoryId());
1061                    sb.append("]]></column-value></column>");
1062                    sb.append(
1063                            "<column><column-name>name</column-name><column-value><![CDATA[");
1064                    sb.append(getName());
1065                    sb.append("]]></column-value></column>");
1066                    sb.append(
1067                            "<column><column-name>description</column-name><column-value><![CDATA[");
1068                    sb.append(getDescription());
1069                    sb.append("]]></column-value></column>");
1070                    sb.append(
1071                            "<column><column-name>displayStyle</column-name><column-value><![CDATA[");
1072                    sb.append(getDisplayStyle());
1073                    sb.append("]]></column-value></column>");
1074                    sb.append(
1075                            "<column><column-name>threadCount</column-name><column-value><![CDATA[");
1076                    sb.append(getThreadCount());
1077                    sb.append("]]></column-value></column>");
1078                    sb.append(
1079                            "<column><column-name>messageCount</column-name><column-value><![CDATA[");
1080                    sb.append(getMessageCount());
1081                    sb.append("]]></column-value></column>");
1082                    sb.append(
1083                            "<column><column-name>lastPostDate</column-name><column-value><![CDATA[");
1084                    sb.append(getLastPostDate());
1085                    sb.append("]]></column-value></column>");
1086                    sb.append(
1087                            "<column><column-name>status</column-name><column-value><![CDATA[");
1088                    sb.append(getStatus());
1089                    sb.append("]]></column-value></column>");
1090                    sb.append(
1091                            "<column><column-name>statusByUserId</column-name><column-value><![CDATA[");
1092                    sb.append(getStatusByUserId());
1093                    sb.append("]]></column-value></column>");
1094                    sb.append(
1095                            "<column><column-name>statusByUserName</column-name><column-value><![CDATA[");
1096                    sb.append(getStatusByUserName());
1097                    sb.append("]]></column-value></column>");
1098                    sb.append(
1099                            "<column><column-name>statusDate</column-name><column-value><![CDATA[");
1100                    sb.append(getStatusDate());
1101                    sb.append("]]></column-value></column>");
1102    
1103                    sb.append("</model>");
1104    
1105                    return sb.toString();
1106            }
1107    
1108            private static ClassLoader _classLoader = MBCategory.class.getClassLoader();
1109            private static Class<?>[] _escapedModelInterfaces = new Class[] {
1110                            MBCategory.class
1111                    };
1112            private String _uuid;
1113            private String _originalUuid;
1114            private long _categoryId;
1115            private long _groupId;
1116            private long _originalGroupId;
1117            private boolean _setOriginalGroupId;
1118            private long _companyId;
1119            private long _originalCompanyId;
1120            private boolean _setOriginalCompanyId;
1121            private long _userId;
1122            private String _userUuid;
1123            private String _userName;
1124            private Date _createDate;
1125            private Date _modifiedDate;
1126            private long _parentCategoryId;
1127            private long _originalParentCategoryId;
1128            private boolean _setOriginalParentCategoryId;
1129            private String _name;
1130            private String _description;
1131            private String _displayStyle;
1132            private int _threadCount;
1133            private int _messageCount;
1134            private Date _lastPostDate;
1135            private int _status;
1136            private int _originalStatus;
1137            private boolean _setOriginalStatus;
1138            private long _statusByUserId;
1139            private String _statusByUserUuid;
1140            private String _statusByUserName;
1141            private Date _statusDate;
1142            private long _columnBitmask;
1143            private MBCategory _escapedModel;
1144    }