001    /**
002     * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
014    
015    package com.liferay.portlet.messageboards.model.impl;
016    
017    import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
018    import com.liferay.portal.kernel.exception.SystemException;
019    import com.liferay.portal.kernel.json.JSON;
020    import com.liferay.portal.kernel.util.DateUtil;
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.MBThread;
034    import com.liferay.portlet.messageboards.model.MBThreadModel;
035    import com.liferay.portlet.messageboards.model.MBThreadSoap;
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 MBThread service. Represents a row in the "MBThread" 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.MBThreadModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link MBThreadImpl}.
052     * </p>
053     *
054     * @author Brian Wing Shun Chan
055     * @see MBThreadImpl
056     * @see com.liferay.portlet.messageboards.model.MBThread
057     * @see com.liferay.portlet.messageboards.model.MBThreadModel
058     * @generated
059     */
060    @JSON(strict = true)
061    public class MBThreadModelImpl extends BaseModelImpl<MBThread>
062            implements MBThreadModel {
063            /*
064             * NOTE FOR DEVELOPERS:
065             *
066             * Never modify or reference this class directly. All methods that expect a message boards thread model instance should use the {@link com.liferay.portlet.messageboards.model.MBThread} interface instead.
067             */
068            public static final String TABLE_NAME = "MBThread";
069            public static final Object[][] TABLE_COLUMNS = {
070                            { "threadId", Types.BIGINT },
071                            { "groupId", Types.BIGINT },
072                            { "companyId", Types.BIGINT },
073                            { "categoryId", Types.BIGINT },
074                            { "rootMessageId", Types.BIGINT },
075                            { "rootMessageUserId", Types.BIGINT },
076                            { "messageCount", Types.INTEGER },
077                            { "viewCount", Types.INTEGER },
078                            { "lastPostByUserId", Types.BIGINT },
079                            { "lastPostDate", Types.TIMESTAMP },
080                            { "priority", Types.DOUBLE },
081                            { "question", Types.BOOLEAN },
082                            { "status", Types.INTEGER },
083                            { "statusByUserId", Types.BIGINT },
084                            { "statusByUserName", Types.VARCHAR },
085                            { "statusDate", Types.TIMESTAMP }
086                    };
087            public static final String TABLE_SQL_CREATE = "create table MBThread (threadId LONG not null primary key,groupId LONG,companyId LONG,categoryId LONG,rootMessageId LONG,rootMessageUserId LONG,messageCount INTEGER,viewCount INTEGER,lastPostByUserId LONG,lastPostDate DATE null,priority DOUBLE,question BOOLEAN,status INTEGER,statusByUserId LONG,statusByUserName VARCHAR(75) null,statusDate DATE null)";
088            public static final String TABLE_SQL_DROP = "drop table MBThread";
089            public static final String ORDER_BY_JPQL = " ORDER BY mbThread.priority DESC, mbThread.lastPostDate DESC";
090            public static final String ORDER_BY_SQL = " ORDER BY MBThread.priority DESC, MBThread.lastPostDate DESC";
091            public static final String DATA_SOURCE = "liferayDataSource";
092            public static final String SESSION_FACTORY = "liferaySessionFactory";
093            public static final String TX_MANAGER = "liferayTransactionManager";
094            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
095                                    "value.object.entity.cache.enabled.com.liferay.portlet.messageboards.model.MBThread"),
096                            true);
097            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
098                                    "value.object.finder.cache.enabled.com.liferay.portlet.messageboards.model.MBThread"),
099                            true);
100            public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
101                                    "value.object.column.bitmask.enabled.com.liferay.portlet.messageboards.model.MBThread"),
102                            true);
103            public static long CATEGORYID_COLUMN_BITMASK = 1L;
104            public static long GROUPID_COLUMN_BITMASK = 2L;
105            public static long LASTPOSTDATE_COLUMN_BITMASK = 4L;
106            public static long PRIORITY_COLUMN_BITMASK = 8L;
107            public static long ROOTMESSAGEID_COLUMN_BITMASK = 16L;
108            public static long STATUS_COLUMN_BITMASK = 32L;
109    
110            /**
111             * Converts the soap model instance into a normal model instance.
112             *
113             * @param soapModel the soap model instance to convert
114             * @return the normal model instance
115             */
116            public static MBThread toModel(MBThreadSoap soapModel) {
117                    if (soapModel == null) {
118                            return null;
119                    }
120    
121                    MBThread model = new MBThreadImpl();
122    
123                    model.setThreadId(soapModel.getThreadId());
124                    model.setGroupId(soapModel.getGroupId());
125                    model.setCompanyId(soapModel.getCompanyId());
126                    model.setCategoryId(soapModel.getCategoryId());
127                    model.setRootMessageId(soapModel.getRootMessageId());
128                    model.setRootMessageUserId(soapModel.getRootMessageUserId());
129                    model.setMessageCount(soapModel.getMessageCount());
130                    model.setViewCount(soapModel.getViewCount());
131                    model.setLastPostByUserId(soapModel.getLastPostByUserId());
132                    model.setLastPostDate(soapModel.getLastPostDate());
133                    model.setPriority(soapModel.getPriority());
134                    model.setQuestion(soapModel.getQuestion());
135                    model.setStatus(soapModel.getStatus());
136                    model.setStatusByUserId(soapModel.getStatusByUserId());
137                    model.setStatusByUserName(soapModel.getStatusByUserName());
138                    model.setStatusDate(soapModel.getStatusDate());
139    
140                    return model;
141            }
142    
143            /**
144             * Converts the soap model instances into normal model instances.
145             *
146             * @param soapModels the soap model instances to convert
147             * @return the normal model instances
148             */
149            public static List<MBThread> toModels(MBThreadSoap[] soapModels) {
150                    if (soapModels == null) {
151                            return null;
152                    }
153    
154                    List<MBThread> models = new ArrayList<MBThread>(soapModels.length);
155    
156                    for (MBThreadSoap soapModel : soapModels) {
157                            models.add(toModel(soapModel));
158                    }
159    
160                    return models;
161            }
162    
163            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
164                                    "lock.expiration.time.com.liferay.portlet.messageboards.model.MBThread"));
165    
166            public MBThreadModelImpl() {
167            }
168    
169            public long getPrimaryKey() {
170                    return _threadId;
171            }
172    
173            public void setPrimaryKey(long primaryKey) {
174                    setThreadId(primaryKey);
175            }
176    
177            public Serializable getPrimaryKeyObj() {
178                    return _threadId;
179            }
180    
181            public void setPrimaryKeyObj(Serializable primaryKeyObj) {
182                    setPrimaryKey(((Long)primaryKeyObj).longValue());
183            }
184    
185            public Class<?> getModelClass() {
186                    return MBThread.class;
187            }
188    
189            public String getModelClassName() {
190                    return MBThread.class.getName();
191            }
192    
193            @Override
194            public Map<String, Object> getModelAttributes() {
195                    Map<String, Object> attributes = new HashMap<String, Object>();
196    
197                    attributes.put("threadId", getThreadId());
198                    attributes.put("groupId", getGroupId());
199                    attributes.put("companyId", getCompanyId());
200                    attributes.put("categoryId", getCategoryId());
201                    attributes.put("rootMessageId", getRootMessageId());
202                    attributes.put("rootMessageUserId", getRootMessageUserId());
203                    attributes.put("messageCount", getMessageCount());
204                    attributes.put("viewCount", getViewCount());
205                    attributes.put("lastPostByUserId", getLastPostByUserId());
206                    attributes.put("lastPostDate", getLastPostDate());
207                    attributes.put("priority", getPriority());
208                    attributes.put("question", getQuestion());
209                    attributes.put("status", getStatus());
210                    attributes.put("statusByUserId", getStatusByUserId());
211                    attributes.put("statusByUserName", getStatusByUserName());
212                    attributes.put("statusDate", getStatusDate());
213    
214                    return attributes;
215            }
216    
217            @Override
218            public void setModelAttributes(Map<String, Object> attributes) {
219                    Long threadId = (Long)attributes.get("threadId");
220    
221                    if (threadId != null) {
222                            setThreadId(threadId);
223                    }
224    
225                    Long groupId = (Long)attributes.get("groupId");
226    
227                    if (groupId != null) {
228                            setGroupId(groupId);
229                    }
230    
231                    Long companyId = (Long)attributes.get("companyId");
232    
233                    if (companyId != null) {
234                            setCompanyId(companyId);
235                    }
236    
237                    Long categoryId = (Long)attributes.get("categoryId");
238    
239                    if (categoryId != null) {
240                            setCategoryId(categoryId);
241                    }
242    
243                    Long rootMessageId = (Long)attributes.get("rootMessageId");
244    
245                    if (rootMessageId != null) {
246                            setRootMessageId(rootMessageId);
247                    }
248    
249                    Long rootMessageUserId = (Long)attributes.get("rootMessageUserId");
250    
251                    if (rootMessageUserId != null) {
252                            setRootMessageUserId(rootMessageUserId);
253                    }
254    
255                    Integer messageCount = (Integer)attributes.get("messageCount");
256    
257                    if (messageCount != null) {
258                            setMessageCount(messageCount);
259                    }
260    
261                    Integer viewCount = (Integer)attributes.get("viewCount");
262    
263                    if (viewCount != null) {
264                            setViewCount(viewCount);
265                    }
266    
267                    Long lastPostByUserId = (Long)attributes.get("lastPostByUserId");
268    
269                    if (lastPostByUserId != null) {
270                            setLastPostByUserId(lastPostByUserId);
271                    }
272    
273                    Date lastPostDate = (Date)attributes.get("lastPostDate");
274    
275                    if (lastPostDate != null) {
276                            setLastPostDate(lastPostDate);
277                    }
278    
279                    Double priority = (Double)attributes.get("priority");
280    
281                    if (priority != null) {
282                            setPriority(priority);
283                    }
284    
285                    Boolean question = (Boolean)attributes.get("question");
286    
287                    if (question != null) {
288                            setQuestion(question);
289                    }
290    
291                    Integer status = (Integer)attributes.get("status");
292    
293                    if (status != null) {
294                            setStatus(status);
295                    }
296    
297                    Long statusByUserId = (Long)attributes.get("statusByUserId");
298    
299                    if (statusByUserId != null) {
300                            setStatusByUserId(statusByUserId);
301                    }
302    
303                    String statusByUserName = (String)attributes.get("statusByUserName");
304    
305                    if (statusByUserName != null) {
306                            setStatusByUserName(statusByUserName);
307                    }
308    
309                    Date statusDate = (Date)attributes.get("statusDate");
310    
311                    if (statusDate != null) {
312                            setStatusDate(statusDate);
313                    }
314            }
315    
316            @JSON
317            public long getThreadId() {
318                    return _threadId;
319            }
320    
321            public void setThreadId(long threadId) {
322                    _threadId = threadId;
323            }
324    
325            @JSON
326            public long getGroupId() {
327                    return _groupId;
328            }
329    
330            public void setGroupId(long groupId) {
331                    _columnBitmask |= GROUPID_COLUMN_BITMASK;
332    
333                    if (!_setOriginalGroupId) {
334                            _setOriginalGroupId = true;
335    
336                            _originalGroupId = _groupId;
337                    }
338    
339                    _groupId = groupId;
340            }
341    
342            public long getOriginalGroupId() {
343                    return _originalGroupId;
344            }
345    
346            @JSON
347            public long getCompanyId() {
348                    return _companyId;
349            }
350    
351            public void setCompanyId(long companyId) {
352                    _companyId = companyId;
353            }
354    
355            @JSON
356            public long getCategoryId() {
357                    return _categoryId;
358            }
359    
360            public void setCategoryId(long categoryId) {
361                    _columnBitmask |= CATEGORYID_COLUMN_BITMASK;
362    
363                    if (!_setOriginalCategoryId) {
364                            _setOriginalCategoryId = true;
365    
366                            _originalCategoryId = _categoryId;
367                    }
368    
369                    _categoryId = categoryId;
370            }
371    
372            public long getOriginalCategoryId() {
373                    return _originalCategoryId;
374            }
375    
376            @JSON
377            public long getRootMessageId() {
378                    return _rootMessageId;
379            }
380    
381            public void setRootMessageId(long rootMessageId) {
382                    _columnBitmask |= ROOTMESSAGEID_COLUMN_BITMASK;
383    
384                    if (!_setOriginalRootMessageId) {
385                            _setOriginalRootMessageId = true;
386    
387                            _originalRootMessageId = _rootMessageId;
388                    }
389    
390                    _rootMessageId = rootMessageId;
391            }
392    
393            public long getOriginalRootMessageId() {
394                    return _originalRootMessageId;
395            }
396    
397            @JSON
398            public long getRootMessageUserId() {
399                    return _rootMessageUserId;
400            }
401    
402            public void setRootMessageUserId(long rootMessageUserId) {
403                    _rootMessageUserId = rootMessageUserId;
404            }
405    
406            public String getRootMessageUserUuid() throws SystemException {
407                    return PortalUtil.getUserValue(getRootMessageUserId(), "uuid",
408                            _rootMessageUserUuid);
409            }
410    
411            public void setRootMessageUserUuid(String rootMessageUserUuid) {
412                    _rootMessageUserUuid = rootMessageUserUuid;
413            }
414    
415            @JSON
416            public int getMessageCount() {
417                    return _messageCount;
418            }
419    
420            public void setMessageCount(int messageCount) {
421                    _messageCount = messageCount;
422            }
423    
424            @JSON
425            public int getViewCount() {
426                    return _viewCount;
427            }
428    
429            public void setViewCount(int viewCount) {
430                    _viewCount = viewCount;
431            }
432    
433            @JSON
434            public long getLastPostByUserId() {
435                    return _lastPostByUserId;
436            }
437    
438            public void setLastPostByUserId(long lastPostByUserId) {
439                    _lastPostByUserId = lastPostByUserId;
440            }
441    
442            public String getLastPostByUserUuid() throws SystemException {
443                    return PortalUtil.getUserValue(getLastPostByUserId(), "uuid",
444                            _lastPostByUserUuid);
445            }
446    
447            public void setLastPostByUserUuid(String lastPostByUserUuid) {
448                    _lastPostByUserUuid = lastPostByUserUuid;
449            }
450    
451            @JSON
452            public Date getLastPostDate() {
453                    return _lastPostDate;
454            }
455    
456            public void setLastPostDate(Date lastPostDate) {
457                    _columnBitmask = -1L;
458    
459                    if (_originalLastPostDate == null) {
460                            _originalLastPostDate = _lastPostDate;
461                    }
462    
463                    _lastPostDate = lastPostDate;
464            }
465    
466            public Date getOriginalLastPostDate() {
467                    return _originalLastPostDate;
468            }
469    
470            @JSON
471            public double getPriority() {
472                    return _priority;
473            }
474    
475            public void setPriority(double priority) {
476                    _columnBitmask = -1L;
477    
478                    if (!_setOriginalPriority) {
479                            _setOriginalPriority = true;
480    
481                            _originalPriority = _priority;
482                    }
483    
484                    _priority = priority;
485            }
486    
487            public double getOriginalPriority() {
488                    return _originalPriority;
489            }
490    
491            @JSON
492            public boolean getQuestion() {
493                    return _question;
494            }
495    
496            public boolean isQuestion() {
497                    return _question;
498            }
499    
500            public void setQuestion(boolean question) {
501                    _question = question;
502            }
503    
504            @JSON
505            public int getStatus() {
506                    return _status;
507            }
508    
509            public void setStatus(int status) {
510                    _columnBitmask |= STATUS_COLUMN_BITMASK;
511    
512                    if (!_setOriginalStatus) {
513                            _setOriginalStatus = true;
514    
515                            _originalStatus = _status;
516                    }
517    
518                    _status = status;
519            }
520    
521            public int getOriginalStatus() {
522                    return _originalStatus;
523            }
524    
525            @JSON
526            public long getStatusByUserId() {
527                    return _statusByUserId;
528            }
529    
530            public void setStatusByUserId(long statusByUserId) {
531                    _statusByUserId = statusByUserId;
532            }
533    
534            public String getStatusByUserUuid() throws SystemException {
535                    return PortalUtil.getUserValue(getStatusByUserId(), "uuid",
536                            _statusByUserUuid);
537            }
538    
539            public void setStatusByUserUuid(String statusByUserUuid) {
540                    _statusByUserUuid = statusByUserUuid;
541            }
542    
543            @JSON
544            public String getStatusByUserName() {
545                    if (_statusByUserName == null) {
546                            return StringPool.BLANK;
547                    }
548                    else {
549                            return _statusByUserName;
550                    }
551            }
552    
553            public void setStatusByUserName(String statusByUserName) {
554                    _statusByUserName = statusByUserName;
555            }
556    
557            @JSON
558            public Date getStatusDate() {
559                    return _statusDate;
560            }
561    
562            public void setStatusDate(Date statusDate) {
563                    _statusDate = statusDate;
564            }
565    
566            /**
567             * @deprecated {@link #isApproved}
568             */
569            public boolean getApproved() {
570                    return isApproved();
571            }
572    
573            public boolean isApproved() {
574                    if (getStatus() == WorkflowConstants.STATUS_APPROVED) {
575                            return true;
576                    }
577                    else {
578                            return false;
579                    }
580            }
581    
582            public boolean isDenied() {
583                    if (getStatus() == WorkflowConstants.STATUS_DENIED) {
584                            return true;
585                    }
586                    else {
587                            return false;
588                    }
589            }
590    
591            public boolean isDraft() {
592                    if (getStatus() == WorkflowConstants.STATUS_DRAFT) {
593                            return true;
594                    }
595                    else {
596                            return false;
597                    }
598            }
599    
600            public boolean isExpired() {
601                    if (getStatus() == WorkflowConstants.STATUS_EXPIRED) {
602                            return true;
603                    }
604                    else {
605                            return false;
606                    }
607            }
608    
609            public boolean isInactive() {
610                    if (getStatus() == WorkflowConstants.STATUS_INACTIVE) {
611                            return true;
612                    }
613                    else {
614                            return false;
615                    }
616            }
617    
618            public boolean isIncomplete() {
619                    if (getStatus() == WorkflowConstants.STATUS_INCOMPLETE) {
620                            return true;
621                    }
622                    else {
623                            return false;
624                    }
625            }
626    
627            public boolean isInTrash() {
628                    if (getStatus() == WorkflowConstants.STATUS_IN_TRASH) {
629                            return true;
630                    }
631                    else {
632                            return false;
633                    }
634            }
635    
636            public boolean isPending() {
637                    if (getStatus() == WorkflowConstants.STATUS_PENDING) {
638                            return true;
639                    }
640                    else {
641                            return false;
642                    }
643            }
644    
645            public boolean isScheduled() {
646                    if (getStatus() == WorkflowConstants.STATUS_SCHEDULED) {
647                            return true;
648                    }
649                    else {
650                            return false;
651                    }
652            }
653    
654            public long getColumnBitmask() {
655                    return _columnBitmask;
656            }
657    
658            @Override
659            public ExpandoBridge getExpandoBridge() {
660                    return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
661                            MBThread.class.getName(), getPrimaryKey());
662            }
663    
664            @Override
665            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
666                    ExpandoBridge expandoBridge = getExpandoBridge();
667    
668                    expandoBridge.setAttributes(serviceContext);
669            }
670    
671            @Override
672            public MBThread toEscapedModel() {
673                    if (_escapedModel == null) {
674                            _escapedModel = (MBThread)ProxyUtil.newProxyInstance(_classLoader,
675                                            _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
676                    }
677    
678                    return _escapedModel;
679            }
680    
681            @Override
682            public Object clone() {
683                    MBThreadImpl mbThreadImpl = new MBThreadImpl();
684    
685                    mbThreadImpl.setThreadId(getThreadId());
686                    mbThreadImpl.setGroupId(getGroupId());
687                    mbThreadImpl.setCompanyId(getCompanyId());
688                    mbThreadImpl.setCategoryId(getCategoryId());
689                    mbThreadImpl.setRootMessageId(getRootMessageId());
690                    mbThreadImpl.setRootMessageUserId(getRootMessageUserId());
691                    mbThreadImpl.setMessageCount(getMessageCount());
692                    mbThreadImpl.setViewCount(getViewCount());
693                    mbThreadImpl.setLastPostByUserId(getLastPostByUserId());
694                    mbThreadImpl.setLastPostDate(getLastPostDate());
695                    mbThreadImpl.setPriority(getPriority());
696                    mbThreadImpl.setQuestion(getQuestion());
697                    mbThreadImpl.setStatus(getStatus());
698                    mbThreadImpl.setStatusByUserId(getStatusByUserId());
699                    mbThreadImpl.setStatusByUserName(getStatusByUserName());
700                    mbThreadImpl.setStatusDate(getStatusDate());
701    
702                    mbThreadImpl.resetOriginalValues();
703    
704                    return mbThreadImpl;
705            }
706    
707            public int compareTo(MBThread mbThread) {
708                    int value = 0;
709    
710                    if (getPriority() < mbThread.getPriority()) {
711                            value = -1;
712                    }
713                    else if (getPriority() > mbThread.getPriority()) {
714                            value = 1;
715                    }
716                    else {
717                            value = 0;
718                    }
719    
720                    value = value * -1;
721    
722                    if (value != 0) {
723                            return value;
724                    }
725    
726                    value = DateUtil.compareTo(getLastPostDate(), mbThread.getLastPostDate());
727    
728                    value = value * -1;
729    
730                    if (value != 0) {
731                            return value;
732                    }
733    
734                    return 0;
735            }
736    
737            @Override
738            public boolean equals(Object obj) {
739                    if (obj == null) {
740                            return false;
741                    }
742    
743                    MBThread mbThread = null;
744    
745                    try {
746                            mbThread = (MBThread)obj;
747                    }
748                    catch (ClassCastException cce) {
749                            return false;
750                    }
751    
752                    long primaryKey = mbThread.getPrimaryKey();
753    
754                    if (getPrimaryKey() == primaryKey) {
755                            return true;
756                    }
757                    else {
758                            return false;
759                    }
760            }
761    
762            @Override
763            public int hashCode() {
764                    return (int)getPrimaryKey();
765            }
766    
767            @Override
768            public void resetOriginalValues() {
769                    MBThreadModelImpl mbThreadModelImpl = this;
770    
771                    mbThreadModelImpl._originalGroupId = mbThreadModelImpl._groupId;
772    
773                    mbThreadModelImpl._setOriginalGroupId = false;
774    
775                    mbThreadModelImpl._originalCategoryId = mbThreadModelImpl._categoryId;
776    
777                    mbThreadModelImpl._setOriginalCategoryId = false;
778    
779                    mbThreadModelImpl._originalRootMessageId = mbThreadModelImpl._rootMessageId;
780    
781                    mbThreadModelImpl._setOriginalRootMessageId = false;
782    
783                    mbThreadModelImpl._originalLastPostDate = mbThreadModelImpl._lastPostDate;
784    
785                    mbThreadModelImpl._originalPriority = mbThreadModelImpl._priority;
786    
787                    mbThreadModelImpl._setOriginalPriority = false;
788    
789                    mbThreadModelImpl._originalStatus = mbThreadModelImpl._status;
790    
791                    mbThreadModelImpl._setOriginalStatus = false;
792    
793                    mbThreadModelImpl._columnBitmask = 0;
794            }
795    
796            @Override
797            public CacheModel<MBThread> toCacheModel() {
798                    MBThreadCacheModel mbThreadCacheModel = new MBThreadCacheModel();
799    
800                    mbThreadCacheModel.threadId = getThreadId();
801    
802                    mbThreadCacheModel.groupId = getGroupId();
803    
804                    mbThreadCacheModel.companyId = getCompanyId();
805    
806                    mbThreadCacheModel.categoryId = getCategoryId();
807    
808                    mbThreadCacheModel.rootMessageId = getRootMessageId();
809    
810                    mbThreadCacheModel.rootMessageUserId = getRootMessageUserId();
811    
812                    mbThreadCacheModel.messageCount = getMessageCount();
813    
814                    mbThreadCacheModel.viewCount = getViewCount();
815    
816                    mbThreadCacheModel.lastPostByUserId = getLastPostByUserId();
817    
818                    Date lastPostDate = getLastPostDate();
819    
820                    if (lastPostDate != null) {
821                            mbThreadCacheModel.lastPostDate = lastPostDate.getTime();
822                    }
823                    else {
824                            mbThreadCacheModel.lastPostDate = Long.MIN_VALUE;
825                    }
826    
827                    mbThreadCacheModel.priority = getPriority();
828    
829                    mbThreadCacheModel.question = getQuestion();
830    
831                    mbThreadCacheModel.status = getStatus();
832    
833                    mbThreadCacheModel.statusByUserId = getStatusByUserId();
834    
835                    mbThreadCacheModel.statusByUserName = getStatusByUserName();
836    
837                    String statusByUserName = mbThreadCacheModel.statusByUserName;
838    
839                    if ((statusByUserName != null) && (statusByUserName.length() == 0)) {
840                            mbThreadCacheModel.statusByUserName = null;
841                    }
842    
843                    Date statusDate = getStatusDate();
844    
845                    if (statusDate != null) {
846                            mbThreadCacheModel.statusDate = statusDate.getTime();
847                    }
848                    else {
849                            mbThreadCacheModel.statusDate = Long.MIN_VALUE;
850                    }
851    
852                    return mbThreadCacheModel;
853            }
854    
855            @Override
856            public String toString() {
857                    StringBundler sb = new StringBundler(33);
858    
859                    sb.append("{threadId=");
860                    sb.append(getThreadId());
861                    sb.append(", groupId=");
862                    sb.append(getGroupId());
863                    sb.append(", companyId=");
864                    sb.append(getCompanyId());
865                    sb.append(", categoryId=");
866                    sb.append(getCategoryId());
867                    sb.append(", rootMessageId=");
868                    sb.append(getRootMessageId());
869                    sb.append(", rootMessageUserId=");
870                    sb.append(getRootMessageUserId());
871                    sb.append(", messageCount=");
872                    sb.append(getMessageCount());
873                    sb.append(", viewCount=");
874                    sb.append(getViewCount());
875                    sb.append(", lastPostByUserId=");
876                    sb.append(getLastPostByUserId());
877                    sb.append(", lastPostDate=");
878                    sb.append(getLastPostDate());
879                    sb.append(", priority=");
880                    sb.append(getPriority());
881                    sb.append(", question=");
882                    sb.append(getQuestion());
883                    sb.append(", status=");
884                    sb.append(getStatus());
885                    sb.append(", statusByUserId=");
886                    sb.append(getStatusByUserId());
887                    sb.append(", statusByUserName=");
888                    sb.append(getStatusByUserName());
889                    sb.append(", statusDate=");
890                    sb.append(getStatusDate());
891                    sb.append("}");
892    
893                    return sb.toString();
894            }
895    
896            public String toXmlString() {
897                    StringBundler sb = new StringBundler(52);
898    
899                    sb.append("<model><model-name>");
900                    sb.append("com.liferay.portlet.messageboards.model.MBThread");
901                    sb.append("</model-name>");
902    
903                    sb.append(
904                            "<column><column-name>threadId</column-name><column-value><![CDATA[");
905                    sb.append(getThreadId());
906                    sb.append("]]></column-value></column>");
907                    sb.append(
908                            "<column><column-name>groupId</column-name><column-value><![CDATA[");
909                    sb.append(getGroupId());
910                    sb.append("]]></column-value></column>");
911                    sb.append(
912                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
913                    sb.append(getCompanyId());
914                    sb.append("]]></column-value></column>");
915                    sb.append(
916                            "<column><column-name>categoryId</column-name><column-value><![CDATA[");
917                    sb.append(getCategoryId());
918                    sb.append("]]></column-value></column>");
919                    sb.append(
920                            "<column><column-name>rootMessageId</column-name><column-value><![CDATA[");
921                    sb.append(getRootMessageId());
922                    sb.append("]]></column-value></column>");
923                    sb.append(
924                            "<column><column-name>rootMessageUserId</column-name><column-value><![CDATA[");
925                    sb.append(getRootMessageUserId());
926                    sb.append("]]></column-value></column>");
927                    sb.append(
928                            "<column><column-name>messageCount</column-name><column-value><![CDATA[");
929                    sb.append(getMessageCount());
930                    sb.append("]]></column-value></column>");
931                    sb.append(
932                            "<column><column-name>viewCount</column-name><column-value><![CDATA[");
933                    sb.append(getViewCount());
934                    sb.append("]]></column-value></column>");
935                    sb.append(
936                            "<column><column-name>lastPostByUserId</column-name><column-value><![CDATA[");
937                    sb.append(getLastPostByUserId());
938                    sb.append("]]></column-value></column>");
939                    sb.append(
940                            "<column><column-name>lastPostDate</column-name><column-value><![CDATA[");
941                    sb.append(getLastPostDate());
942                    sb.append("]]></column-value></column>");
943                    sb.append(
944                            "<column><column-name>priority</column-name><column-value><![CDATA[");
945                    sb.append(getPriority());
946                    sb.append("]]></column-value></column>");
947                    sb.append(
948                            "<column><column-name>question</column-name><column-value><![CDATA[");
949                    sb.append(getQuestion());
950                    sb.append("]]></column-value></column>");
951                    sb.append(
952                            "<column><column-name>status</column-name><column-value><![CDATA[");
953                    sb.append(getStatus());
954                    sb.append("]]></column-value></column>");
955                    sb.append(
956                            "<column><column-name>statusByUserId</column-name><column-value><![CDATA[");
957                    sb.append(getStatusByUserId());
958                    sb.append("]]></column-value></column>");
959                    sb.append(
960                            "<column><column-name>statusByUserName</column-name><column-value><![CDATA[");
961                    sb.append(getStatusByUserName());
962                    sb.append("]]></column-value></column>");
963                    sb.append(
964                            "<column><column-name>statusDate</column-name><column-value><![CDATA[");
965                    sb.append(getStatusDate());
966                    sb.append("]]></column-value></column>");
967    
968                    sb.append("</model>");
969    
970                    return sb.toString();
971            }
972    
973            private static ClassLoader _classLoader = MBThread.class.getClassLoader();
974            private static Class<?>[] _escapedModelInterfaces = new Class[] {
975                            MBThread.class
976                    };
977            private long _threadId;
978            private long _groupId;
979            private long _originalGroupId;
980            private boolean _setOriginalGroupId;
981            private long _companyId;
982            private long _categoryId;
983            private long _originalCategoryId;
984            private boolean _setOriginalCategoryId;
985            private long _rootMessageId;
986            private long _originalRootMessageId;
987            private boolean _setOriginalRootMessageId;
988            private long _rootMessageUserId;
989            private String _rootMessageUserUuid;
990            private int _messageCount;
991            private int _viewCount;
992            private long _lastPostByUserId;
993            private String _lastPostByUserUuid;
994            private Date _lastPostDate;
995            private Date _originalLastPostDate;
996            private double _priority;
997            private double _originalPriority;
998            private boolean _setOriginalPriority;
999            private boolean _question;
1000            private int _status;
1001            private int _originalStatus;
1002            private boolean _setOriginalStatus;
1003            private long _statusByUserId;
1004            private String _statusByUserUuid;
1005            private String _statusByUserName;
1006            private Date _statusDate;
1007            private long _columnBitmask;
1008            private MBThread _escapedModel;
1009    }