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