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