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()) {
618                            return null;
619                    }
620    
621                    TrashEntry trashEntry = TrashEntryLocalServiceUtil.fetchEntry(getModelClassName(),
622                                    getTrashEntryClassPK());
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 long getTrashEntryClassPK() {
655                    return getPrimaryKey();
656            }
657    
658            @Override
659            public TrashHandler getTrashHandler() {
660                    return TrashHandlerRegistryUtil.getTrashHandler(getModelClassName());
661            }
662    
663            @Override
664            public boolean isInTrash() {
665                    if (getStatus() == WorkflowConstants.STATUS_IN_TRASH) {
666                            return true;
667                    }
668                    else {
669                            return false;
670                    }
671            }
672    
673            @Override
674            public boolean isInTrashContainer() {
675                    TrashHandler trashHandler = getTrashHandler();
676    
677                    if ((trashHandler == null) ||
678                                    Validator.isNull(trashHandler.getContainerModelClassName())) {
679                            return false;
680                    }
681    
682                    try {
683                            ContainerModel containerModel = trashHandler.getParentContainerModel(this);
684    
685                            if (containerModel == null) {
686                                    return false;
687                            }
688    
689                            if (containerModel instanceof TrashedModel) {
690                                    return ((TrashedModel)containerModel).isInTrash();
691                            }
692                    }
693                    catch (Exception e) {
694                    }
695    
696                    return false;
697            }
698    
699            /**
700             * @deprecated As of 6.1.0, replaced by {@link #isApproved}
701             */
702            @Override
703            public boolean getApproved() {
704                    return isApproved();
705            }
706    
707            @Override
708            public boolean isApproved() {
709                    if (getStatus() == WorkflowConstants.STATUS_APPROVED) {
710                            return true;
711                    }
712                    else {
713                            return false;
714                    }
715            }
716    
717            @Override
718            public boolean isDenied() {
719                    if (getStatus() == WorkflowConstants.STATUS_DENIED) {
720                            return true;
721                    }
722                    else {
723                            return false;
724                    }
725            }
726    
727            @Override
728            public boolean isDraft() {
729                    if (getStatus() == WorkflowConstants.STATUS_DRAFT) {
730                            return true;
731                    }
732                    else {
733                            return false;
734                    }
735            }
736    
737            @Override
738            public boolean isExpired() {
739                    if (getStatus() == WorkflowConstants.STATUS_EXPIRED) {
740                            return true;
741                    }
742                    else {
743                            return false;
744                    }
745            }
746    
747            @Override
748            public boolean isInactive() {
749                    if (getStatus() == WorkflowConstants.STATUS_INACTIVE) {
750                            return true;
751                    }
752                    else {
753                            return false;
754                    }
755            }
756    
757            @Override
758            public boolean isIncomplete() {
759                    if (getStatus() == WorkflowConstants.STATUS_INCOMPLETE) {
760                            return true;
761                    }
762                    else {
763                            return false;
764                    }
765            }
766    
767            @Override
768            public boolean isPending() {
769                    if (getStatus() == WorkflowConstants.STATUS_PENDING) {
770                            return true;
771                    }
772                    else {
773                            return false;
774                    }
775            }
776    
777            @Override
778            public boolean isScheduled() {
779                    if (getStatus() == WorkflowConstants.STATUS_SCHEDULED) {
780                            return true;
781                    }
782                    else {
783                            return false;
784                    }
785            }
786    
787            public long getColumnBitmask() {
788                    return _columnBitmask;
789            }
790    
791            @Override
792            public ExpandoBridge getExpandoBridge() {
793                    return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
794                            WikiNode.class.getName(), getPrimaryKey());
795            }
796    
797            @Override
798            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
799                    ExpandoBridge expandoBridge = getExpandoBridge();
800    
801                    expandoBridge.setAttributes(serviceContext);
802            }
803    
804            @Override
805            public WikiNode toEscapedModel() {
806                    if (_escapedModel == null) {
807                            _escapedModel = (WikiNode)ProxyUtil.newProxyInstance(_classLoader,
808                                            _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
809                    }
810    
811                    return _escapedModel;
812            }
813    
814            @Override
815            public Object clone() {
816                    WikiNodeImpl wikiNodeImpl = new WikiNodeImpl();
817    
818                    wikiNodeImpl.setUuid(getUuid());
819                    wikiNodeImpl.setNodeId(getNodeId());
820                    wikiNodeImpl.setGroupId(getGroupId());
821                    wikiNodeImpl.setCompanyId(getCompanyId());
822                    wikiNodeImpl.setUserId(getUserId());
823                    wikiNodeImpl.setUserName(getUserName());
824                    wikiNodeImpl.setCreateDate(getCreateDate());
825                    wikiNodeImpl.setModifiedDate(getModifiedDate());
826                    wikiNodeImpl.setName(getName());
827                    wikiNodeImpl.setDescription(getDescription());
828                    wikiNodeImpl.setLastPostDate(getLastPostDate());
829                    wikiNodeImpl.setStatus(getStatus());
830                    wikiNodeImpl.setStatusByUserId(getStatusByUserId());
831                    wikiNodeImpl.setStatusByUserName(getStatusByUserName());
832                    wikiNodeImpl.setStatusDate(getStatusDate());
833    
834                    wikiNodeImpl.resetOriginalValues();
835    
836                    return wikiNodeImpl;
837            }
838    
839            @Override
840            public int compareTo(WikiNode wikiNode) {
841                    int value = 0;
842    
843                    value = getName().compareToIgnoreCase(wikiNode.getName());
844    
845                    if (value != 0) {
846                            return value;
847                    }
848    
849                    return 0;
850            }
851    
852            @Override
853            public boolean equals(Object obj) {
854                    if (this == obj) {
855                            return true;
856                    }
857    
858                    if (!(obj instanceof WikiNode)) {
859                            return false;
860                    }
861    
862                    WikiNode wikiNode = (WikiNode)obj;
863    
864                    long primaryKey = wikiNode.getPrimaryKey();
865    
866                    if (getPrimaryKey() == primaryKey) {
867                            return true;
868                    }
869                    else {
870                            return false;
871                    }
872            }
873    
874            @Override
875            public int hashCode() {
876                    return (int)getPrimaryKey();
877            }
878    
879            @Override
880            public void resetOriginalValues() {
881                    WikiNodeModelImpl wikiNodeModelImpl = this;
882    
883                    wikiNodeModelImpl._originalUuid = wikiNodeModelImpl._uuid;
884    
885                    wikiNodeModelImpl._originalGroupId = wikiNodeModelImpl._groupId;
886    
887                    wikiNodeModelImpl._setOriginalGroupId = false;
888    
889                    wikiNodeModelImpl._originalCompanyId = wikiNodeModelImpl._companyId;
890    
891                    wikiNodeModelImpl._setOriginalCompanyId = false;
892    
893                    wikiNodeModelImpl._originalName = wikiNodeModelImpl._name;
894    
895                    wikiNodeModelImpl._originalStatus = wikiNodeModelImpl._status;
896    
897                    wikiNodeModelImpl._setOriginalStatus = false;
898    
899                    wikiNodeModelImpl._columnBitmask = 0;
900            }
901    
902            @Override
903            public CacheModel<WikiNode> toCacheModel() {
904                    WikiNodeCacheModel wikiNodeCacheModel = new WikiNodeCacheModel();
905    
906                    wikiNodeCacheModel.uuid = getUuid();
907    
908                    String uuid = wikiNodeCacheModel.uuid;
909    
910                    if ((uuid != null) && (uuid.length() == 0)) {
911                            wikiNodeCacheModel.uuid = null;
912                    }
913    
914                    wikiNodeCacheModel.nodeId = getNodeId();
915    
916                    wikiNodeCacheModel.groupId = getGroupId();
917    
918                    wikiNodeCacheModel.companyId = getCompanyId();
919    
920                    wikiNodeCacheModel.userId = getUserId();
921    
922                    wikiNodeCacheModel.userName = getUserName();
923    
924                    String userName = wikiNodeCacheModel.userName;
925    
926                    if ((userName != null) && (userName.length() == 0)) {
927                            wikiNodeCacheModel.userName = null;
928                    }
929    
930                    Date createDate = getCreateDate();
931    
932                    if (createDate != null) {
933                            wikiNodeCacheModel.createDate = createDate.getTime();
934                    }
935                    else {
936                            wikiNodeCacheModel.createDate = Long.MIN_VALUE;
937                    }
938    
939                    Date modifiedDate = getModifiedDate();
940    
941                    if (modifiedDate != null) {
942                            wikiNodeCacheModel.modifiedDate = modifiedDate.getTime();
943                    }
944                    else {
945                            wikiNodeCacheModel.modifiedDate = Long.MIN_VALUE;
946                    }
947    
948                    wikiNodeCacheModel.name = getName();
949    
950                    String name = wikiNodeCacheModel.name;
951    
952                    if ((name != null) && (name.length() == 0)) {
953                            wikiNodeCacheModel.name = null;
954                    }
955    
956                    wikiNodeCacheModel.description = getDescription();
957    
958                    String description = wikiNodeCacheModel.description;
959    
960                    if ((description != null) && (description.length() == 0)) {
961                            wikiNodeCacheModel.description = null;
962                    }
963    
964                    Date lastPostDate = getLastPostDate();
965    
966                    if (lastPostDate != null) {
967                            wikiNodeCacheModel.lastPostDate = lastPostDate.getTime();
968                    }
969                    else {
970                            wikiNodeCacheModel.lastPostDate = Long.MIN_VALUE;
971                    }
972    
973                    wikiNodeCacheModel.status = getStatus();
974    
975                    wikiNodeCacheModel.statusByUserId = getStatusByUserId();
976    
977                    wikiNodeCacheModel.statusByUserName = getStatusByUserName();
978    
979                    String statusByUserName = wikiNodeCacheModel.statusByUserName;
980    
981                    if ((statusByUserName != null) && (statusByUserName.length() == 0)) {
982                            wikiNodeCacheModel.statusByUserName = null;
983                    }
984    
985                    Date statusDate = getStatusDate();
986    
987                    if (statusDate != null) {
988                            wikiNodeCacheModel.statusDate = statusDate.getTime();
989                    }
990                    else {
991                            wikiNodeCacheModel.statusDate = Long.MIN_VALUE;
992                    }
993    
994                    return wikiNodeCacheModel;
995            }
996    
997            @Override
998            public String toString() {
999                    StringBundler sb = new StringBundler(31);
1000    
1001                    sb.append("{uuid=");
1002                    sb.append(getUuid());
1003                    sb.append(", nodeId=");
1004                    sb.append(getNodeId());
1005                    sb.append(", groupId=");
1006                    sb.append(getGroupId());
1007                    sb.append(", companyId=");
1008                    sb.append(getCompanyId());
1009                    sb.append(", userId=");
1010                    sb.append(getUserId());
1011                    sb.append(", userName=");
1012                    sb.append(getUserName());
1013                    sb.append(", createDate=");
1014                    sb.append(getCreateDate());
1015                    sb.append(", modifiedDate=");
1016                    sb.append(getModifiedDate());
1017                    sb.append(", name=");
1018                    sb.append(getName());
1019                    sb.append(", description=");
1020                    sb.append(getDescription());
1021                    sb.append(", lastPostDate=");
1022                    sb.append(getLastPostDate());
1023                    sb.append(", status=");
1024                    sb.append(getStatus());
1025                    sb.append(", statusByUserId=");
1026                    sb.append(getStatusByUserId());
1027                    sb.append(", statusByUserName=");
1028                    sb.append(getStatusByUserName());
1029                    sb.append(", statusDate=");
1030                    sb.append(getStatusDate());
1031                    sb.append("}");
1032    
1033                    return sb.toString();
1034            }
1035    
1036            @Override
1037            public String toXmlString() {
1038                    StringBundler sb = new StringBundler(49);
1039    
1040                    sb.append("<model><model-name>");
1041                    sb.append("com.liferay.portlet.wiki.model.WikiNode");
1042                    sb.append("</model-name>");
1043    
1044                    sb.append(
1045                            "<column><column-name>uuid</column-name><column-value><![CDATA[");
1046                    sb.append(getUuid());
1047                    sb.append("]]></column-value></column>");
1048                    sb.append(
1049                            "<column><column-name>nodeId</column-name><column-value><![CDATA[");
1050                    sb.append(getNodeId());
1051                    sb.append("]]></column-value></column>");
1052                    sb.append(
1053                            "<column><column-name>groupId</column-name><column-value><![CDATA[");
1054                    sb.append(getGroupId());
1055                    sb.append("]]></column-value></column>");
1056                    sb.append(
1057                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
1058                    sb.append(getCompanyId());
1059                    sb.append("]]></column-value></column>");
1060                    sb.append(
1061                            "<column><column-name>userId</column-name><column-value><![CDATA[");
1062                    sb.append(getUserId());
1063                    sb.append("]]></column-value></column>");
1064                    sb.append(
1065                            "<column><column-name>userName</column-name><column-value><![CDATA[");
1066                    sb.append(getUserName());
1067                    sb.append("]]></column-value></column>");
1068                    sb.append(
1069                            "<column><column-name>createDate</column-name><column-value><![CDATA[");
1070                    sb.append(getCreateDate());
1071                    sb.append("]]></column-value></column>");
1072                    sb.append(
1073                            "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
1074                    sb.append(getModifiedDate());
1075                    sb.append("]]></column-value></column>");
1076                    sb.append(
1077                            "<column><column-name>name</column-name><column-value><![CDATA[");
1078                    sb.append(getName());
1079                    sb.append("]]></column-value></column>");
1080                    sb.append(
1081                            "<column><column-name>description</column-name><column-value><![CDATA[");
1082                    sb.append(getDescription());
1083                    sb.append("]]></column-value></column>");
1084                    sb.append(
1085                            "<column><column-name>lastPostDate</column-name><column-value><![CDATA[");
1086                    sb.append(getLastPostDate());
1087                    sb.append("]]></column-value></column>");
1088                    sb.append(
1089                            "<column><column-name>status</column-name><column-value><![CDATA[");
1090                    sb.append(getStatus());
1091                    sb.append("]]></column-value></column>");
1092                    sb.append(
1093                            "<column><column-name>statusByUserId</column-name><column-value><![CDATA[");
1094                    sb.append(getStatusByUserId());
1095                    sb.append("]]></column-value></column>");
1096                    sb.append(
1097                            "<column><column-name>statusByUserName</column-name><column-value><![CDATA[");
1098                    sb.append(getStatusByUserName());
1099                    sb.append("]]></column-value></column>");
1100                    sb.append(
1101                            "<column><column-name>statusDate</column-name><column-value><![CDATA[");
1102                    sb.append(getStatusDate());
1103                    sb.append("]]></column-value></column>");
1104    
1105                    sb.append("</model>");
1106    
1107                    return sb.toString();
1108            }
1109    
1110            private static ClassLoader _classLoader = WikiNode.class.getClassLoader();
1111            private static Class<?>[] _escapedModelInterfaces = new Class[] {
1112                            WikiNode.class
1113                    };
1114            private String _uuid;
1115            private String _originalUuid;
1116            private long _nodeId;
1117            private long _groupId;
1118            private long _originalGroupId;
1119            private boolean _setOriginalGroupId;
1120            private long _companyId;
1121            private long _originalCompanyId;
1122            private boolean _setOriginalCompanyId;
1123            private long _userId;
1124            private String _userUuid;
1125            private String _userName;
1126            private Date _createDate;
1127            private Date _modifiedDate;
1128            private String _name;
1129            private String _originalName;
1130            private String _description;
1131            private Date _lastPostDate;
1132            private int _status;
1133            private int _originalStatus;
1134            private boolean _setOriginalStatus;
1135            private long _statusByUserId;
1136            private String _statusByUserUuid;
1137            private String _statusByUserName;
1138            private Date _statusDate;
1139            private long _columnBitmask;
1140            private WikiNode _escapedModel;
1141    }