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 new Long(_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 (_escapedModelProxy == null) {
674                            _escapedModelProxy = (MBThread)ProxyUtil.newProxyInstance(_classLoader,
675                                            _escapedModelProxyInterfaces,
676                                            new AutoEscapeBeanHandler(this));
677                    }
678    
679                    return _escapedModelProxy;
680            }
681    
682            @Override
683            public Object clone() {
684                    MBThreadImpl mbThreadImpl = new MBThreadImpl();
685    
686                    mbThreadImpl.setThreadId(getThreadId());
687                    mbThreadImpl.setGroupId(getGroupId());
688                    mbThreadImpl.setCompanyId(getCompanyId());
689                    mbThreadImpl.setCategoryId(getCategoryId());
690                    mbThreadImpl.setRootMessageId(getRootMessageId());
691                    mbThreadImpl.setRootMessageUserId(getRootMessageUserId());
692                    mbThreadImpl.setMessageCount(getMessageCount());
693                    mbThreadImpl.setViewCount(getViewCount());
694                    mbThreadImpl.setLastPostByUserId(getLastPostByUserId());
695                    mbThreadImpl.setLastPostDate(getLastPostDate());
696                    mbThreadImpl.setPriority(getPriority());
697                    mbThreadImpl.setQuestion(getQuestion());
698                    mbThreadImpl.setStatus(getStatus());
699                    mbThreadImpl.setStatusByUserId(getStatusByUserId());
700                    mbThreadImpl.setStatusByUserName(getStatusByUserName());
701                    mbThreadImpl.setStatusDate(getStatusDate());
702    
703                    mbThreadImpl.resetOriginalValues();
704    
705                    return mbThreadImpl;
706            }
707    
708            public int compareTo(MBThread mbThread) {
709                    int value = 0;
710    
711                    if (getPriority() < mbThread.getPriority()) {
712                            value = -1;
713                    }
714                    else if (getPriority() > mbThread.getPriority()) {
715                            value = 1;
716                    }
717                    else {
718                            value = 0;
719                    }
720    
721                    value = value * -1;
722    
723                    if (value != 0) {
724                            return value;
725                    }
726    
727                    value = DateUtil.compareTo(getLastPostDate(), mbThread.getLastPostDate());
728    
729                    value = value * -1;
730    
731                    if (value != 0) {
732                            return value;
733                    }
734    
735                    return 0;
736            }
737    
738            @Override
739            public boolean equals(Object obj) {
740                    if (obj == null) {
741                            return false;
742                    }
743    
744                    MBThread mbThread = null;
745    
746                    try {
747                            mbThread = (MBThread)obj;
748                    }
749                    catch (ClassCastException cce) {
750                            return false;
751                    }
752    
753                    long primaryKey = mbThread.getPrimaryKey();
754    
755                    if (getPrimaryKey() == primaryKey) {
756                            return true;
757                    }
758                    else {
759                            return false;
760                    }
761            }
762    
763            @Override
764            public int hashCode() {
765                    return (int)getPrimaryKey();
766            }
767    
768            @Override
769            public void resetOriginalValues() {
770                    MBThreadModelImpl mbThreadModelImpl = this;
771    
772                    mbThreadModelImpl._originalGroupId = mbThreadModelImpl._groupId;
773    
774                    mbThreadModelImpl._setOriginalGroupId = false;
775    
776                    mbThreadModelImpl._originalCategoryId = mbThreadModelImpl._categoryId;
777    
778                    mbThreadModelImpl._setOriginalCategoryId = false;
779    
780                    mbThreadModelImpl._originalRootMessageId = mbThreadModelImpl._rootMessageId;
781    
782                    mbThreadModelImpl._setOriginalRootMessageId = false;
783    
784                    mbThreadModelImpl._originalLastPostDate = mbThreadModelImpl._lastPostDate;
785    
786                    mbThreadModelImpl._originalPriority = mbThreadModelImpl._priority;
787    
788                    mbThreadModelImpl._setOriginalPriority = false;
789    
790                    mbThreadModelImpl._originalStatus = mbThreadModelImpl._status;
791    
792                    mbThreadModelImpl._setOriginalStatus = false;
793    
794                    mbThreadModelImpl._columnBitmask = 0;
795            }
796    
797            @Override
798            public CacheModel<MBThread> toCacheModel() {
799                    MBThreadCacheModel mbThreadCacheModel = new MBThreadCacheModel();
800    
801                    mbThreadCacheModel.threadId = getThreadId();
802    
803                    mbThreadCacheModel.groupId = getGroupId();
804    
805                    mbThreadCacheModel.companyId = getCompanyId();
806    
807                    mbThreadCacheModel.categoryId = getCategoryId();
808    
809                    mbThreadCacheModel.rootMessageId = getRootMessageId();
810    
811                    mbThreadCacheModel.rootMessageUserId = getRootMessageUserId();
812    
813                    mbThreadCacheModel.messageCount = getMessageCount();
814    
815                    mbThreadCacheModel.viewCount = getViewCount();
816    
817                    mbThreadCacheModel.lastPostByUserId = getLastPostByUserId();
818    
819                    Date lastPostDate = getLastPostDate();
820    
821                    if (lastPostDate != null) {
822                            mbThreadCacheModel.lastPostDate = lastPostDate.getTime();
823                    }
824                    else {
825                            mbThreadCacheModel.lastPostDate = Long.MIN_VALUE;
826                    }
827    
828                    mbThreadCacheModel.priority = getPriority();
829    
830                    mbThreadCacheModel.question = getQuestion();
831    
832                    mbThreadCacheModel.status = getStatus();
833    
834                    mbThreadCacheModel.statusByUserId = getStatusByUserId();
835    
836                    mbThreadCacheModel.statusByUserName = getStatusByUserName();
837    
838                    String statusByUserName = mbThreadCacheModel.statusByUserName;
839    
840                    if ((statusByUserName != null) && (statusByUserName.length() == 0)) {
841                            mbThreadCacheModel.statusByUserName = null;
842                    }
843    
844                    Date statusDate = getStatusDate();
845    
846                    if (statusDate != null) {
847                            mbThreadCacheModel.statusDate = statusDate.getTime();
848                    }
849                    else {
850                            mbThreadCacheModel.statusDate = Long.MIN_VALUE;
851                    }
852    
853                    return mbThreadCacheModel;
854            }
855    
856            @Override
857            public String toString() {
858                    StringBundler sb = new StringBundler(33);
859    
860                    sb.append("{threadId=");
861                    sb.append(getThreadId());
862                    sb.append(", groupId=");
863                    sb.append(getGroupId());
864                    sb.append(", companyId=");
865                    sb.append(getCompanyId());
866                    sb.append(", categoryId=");
867                    sb.append(getCategoryId());
868                    sb.append(", rootMessageId=");
869                    sb.append(getRootMessageId());
870                    sb.append(", rootMessageUserId=");
871                    sb.append(getRootMessageUserId());
872                    sb.append(", messageCount=");
873                    sb.append(getMessageCount());
874                    sb.append(", viewCount=");
875                    sb.append(getViewCount());
876                    sb.append(", lastPostByUserId=");
877                    sb.append(getLastPostByUserId());
878                    sb.append(", lastPostDate=");
879                    sb.append(getLastPostDate());
880                    sb.append(", priority=");
881                    sb.append(getPriority());
882                    sb.append(", question=");
883                    sb.append(getQuestion());
884                    sb.append(", status=");
885                    sb.append(getStatus());
886                    sb.append(", statusByUserId=");
887                    sb.append(getStatusByUserId());
888                    sb.append(", statusByUserName=");
889                    sb.append(getStatusByUserName());
890                    sb.append(", statusDate=");
891                    sb.append(getStatusDate());
892                    sb.append("}");
893    
894                    return sb.toString();
895            }
896    
897            public String toXmlString() {
898                    StringBundler sb = new StringBundler(52);
899    
900                    sb.append("<model><model-name>");
901                    sb.append("com.liferay.portlet.messageboards.model.MBThread");
902                    sb.append("</model-name>");
903    
904                    sb.append(
905                            "<column><column-name>threadId</column-name><column-value><![CDATA[");
906                    sb.append(getThreadId());
907                    sb.append("]]></column-value></column>");
908                    sb.append(
909                            "<column><column-name>groupId</column-name><column-value><![CDATA[");
910                    sb.append(getGroupId());
911                    sb.append("]]></column-value></column>");
912                    sb.append(
913                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
914                    sb.append(getCompanyId());
915                    sb.append("]]></column-value></column>");
916                    sb.append(
917                            "<column><column-name>categoryId</column-name><column-value><![CDATA[");
918                    sb.append(getCategoryId());
919                    sb.append("]]></column-value></column>");
920                    sb.append(
921                            "<column><column-name>rootMessageId</column-name><column-value><![CDATA[");
922                    sb.append(getRootMessageId());
923                    sb.append("]]></column-value></column>");
924                    sb.append(
925                            "<column><column-name>rootMessageUserId</column-name><column-value><![CDATA[");
926                    sb.append(getRootMessageUserId());
927                    sb.append("]]></column-value></column>");
928                    sb.append(
929                            "<column><column-name>messageCount</column-name><column-value><![CDATA[");
930                    sb.append(getMessageCount());
931                    sb.append("]]></column-value></column>");
932                    sb.append(
933                            "<column><column-name>viewCount</column-name><column-value><![CDATA[");
934                    sb.append(getViewCount());
935                    sb.append("]]></column-value></column>");
936                    sb.append(
937                            "<column><column-name>lastPostByUserId</column-name><column-value><![CDATA[");
938                    sb.append(getLastPostByUserId());
939                    sb.append("]]></column-value></column>");
940                    sb.append(
941                            "<column><column-name>lastPostDate</column-name><column-value><![CDATA[");
942                    sb.append(getLastPostDate());
943                    sb.append("]]></column-value></column>");
944                    sb.append(
945                            "<column><column-name>priority</column-name><column-value><![CDATA[");
946                    sb.append(getPriority());
947                    sb.append("]]></column-value></column>");
948                    sb.append(
949                            "<column><column-name>question</column-name><column-value><![CDATA[");
950                    sb.append(getQuestion());
951                    sb.append("]]></column-value></column>");
952                    sb.append(
953                            "<column><column-name>status</column-name><column-value><![CDATA[");
954                    sb.append(getStatus());
955                    sb.append("]]></column-value></column>");
956                    sb.append(
957                            "<column><column-name>statusByUserId</column-name><column-value><![CDATA[");
958                    sb.append(getStatusByUserId());
959                    sb.append("]]></column-value></column>");
960                    sb.append(
961                            "<column><column-name>statusByUserName</column-name><column-value><![CDATA[");
962                    sb.append(getStatusByUserName());
963                    sb.append("]]></column-value></column>");
964                    sb.append(
965                            "<column><column-name>statusDate</column-name><column-value><![CDATA[");
966                    sb.append(getStatusDate());
967                    sb.append("]]></column-value></column>");
968    
969                    sb.append("</model>");
970    
971                    return sb.toString();
972            }
973    
974            private static ClassLoader _classLoader = MBThread.class.getClassLoader();
975            private static Class<?>[] _escapedModelProxyInterfaces = new Class[] {
976                            MBThread.class
977                    };
978            private long _threadId;
979            private long _groupId;
980            private long _originalGroupId;
981            private boolean _setOriginalGroupId;
982            private long _companyId;
983            private long _categoryId;
984            private long _originalCategoryId;
985            private boolean _setOriginalCategoryId;
986            private long _rootMessageId;
987            private long _originalRootMessageId;
988            private boolean _setOriginalRootMessageId;
989            private long _rootMessageUserId;
990            private String _rootMessageUserUuid;
991            private int _messageCount;
992            private int _viewCount;
993            private long _lastPostByUserId;
994            private String _lastPostByUserUuid;
995            private Date _lastPostDate;
996            private Date _originalLastPostDate;
997            private double _priority;
998            private double _originalPriority;
999            private boolean _setOriginalPriority;
1000            private boolean _question;
1001            private int _status;
1002            private int _originalStatus;
1003            private boolean _setOriginalStatus;
1004            private long _statusByUserId;
1005            private String _statusByUserUuid;
1006            private String _statusByUserName;
1007            private Date _statusDate;
1008            private long _columnBitmask;
1009            private MBThread _escapedModelProxy;
1010    }