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