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