001    /**
002     * Copyright (c) 2000-2012 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portlet.documentlibrary.model.impl;
016    
017    import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
018    import com.liferay.portal.kernel.exception.SystemException;
019    import com.liferay.portal.kernel.json.JSON;
020    import com.liferay.portal.kernel.util.DateUtil;
021    import com.liferay.portal.kernel.util.GetterUtil;
022    import com.liferay.portal.kernel.util.ProxyUtil;
023    import com.liferay.portal.kernel.util.StringBundler;
024    import com.liferay.portal.kernel.util.StringPool;
025    import com.liferay.portal.kernel.workflow.WorkflowConstants;
026    import com.liferay.portal.model.CacheModel;
027    import com.liferay.portal.model.impl.BaseModelImpl;
028    import com.liferay.portal.service.ServiceContext;
029    import com.liferay.portal.util.PortalUtil;
030    
031    import com.liferay.portlet.documentlibrary.model.DLFileVersion;
032    import com.liferay.portlet.documentlibrary.model.DLFileVersionModel;
033    import com.liferay.portlet.documentlibrary.model.DLFileVersionSoap;
034    import com.liferay.portlet.expando.model.ExpandoBridge;
035    import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
036    
037    import java.io.Serializable;
038    
039    import java.sql.Types;
040    
041    import java.util.ArrayList;
042    import java.util.Date;
043    import java.util.HashMap;
044    import java.util.List;
045    import java.util.Map;
046    
047    /**
048     * The base model implementation for the DLFileVersion service. Represents a row in the "DLFileVersion" database table, with each column mapped to a property of this class.
049     *
050     * <p>
051     * This implementation and its corresponding interface {@link com.liferay.portlet.documentlibrary.model.DLFileVersionModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link DLFileVersionImpl}.
052     * </p>
053     *
054     * @author Brian Wing Shun Chan
055     * @see DLFileVersionImpl
056     * @see com.liferay.portlet.documentlibrary.model.DLFileVersion
057     * @see com.liferay.portlet.documentlibrary.model.DLFileVersionModel
058     * @generated
059     */
060    @JSON(strict = true)
061    public class DLFileVersionModelImpl extends BaseModelImpl<DLFileVersion>
062            implements DLFileVersionModel {
063            /*
064             * NOTE FOR DEVELOPERS:
065             *
066             * Never modify or reference this class directly. All methods that expect a document library file version model instance should use the {@link com.liferay.portlet.documentlibrary.model.DLFileVersion} interface instead.
067             */
068            public static final String TABLE_NAME = "DLFileVersion";
069            public static final Object[][] TABLE_COLUMNS = {
070                            { "uuid_", Types.VARCHAR },
071                            { "fileVersionId", Types.BIGINT },
072                            { "groupId", Types.BIGINT },
073                            { "companyId", Types.BIGINT },
074                            { "userId", Types.BIGINT },
075                            { "userName", Types.VARCHAR },
076                            { "createDate", Types.TIMESTAMP },
077                            { "modifiedDate", Types.TIMESTAMP },
078                            { "repositoryId", Types.BIGINT },
079                            { "folderId", Types.BIGINT },
080                            { "fileEntryId", Types.BIGINT },
081                            { "extension", Types.VARCHAR },
082                            { "mimeType", Types.VARCHAR },
083                            { "title", Types.VARCHAR },
084                            { "description", Types.VARCHAR },
085                            { "changeLog", Types.VARCHAR },
086                            { "extraSettings", Types.CLOB },
087                            { "fileEntryTypeId", Types.BIGINT },
088                            { "version", Types.VARCHAR },
089                            { "size_", Types.BIGINT },
090                            { "status", Types.INTEGER },
091                            { "statusByUserId", Types.BIGINT },
092                            { "statusByUserName", Types.VARCHAR },
093                            { "statusDate", Types.TIMESTAMP }
094                    };
095            public static final String TABLE_SQL_CREATE = "create table DLFileVersion (uuid_ VARCHAR(75) null,fileVersionId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,repositoryId LONG,folderId LONG,fileEntryId LONG,extension VARCHAR(75) null,mimeType VARCHAR(75) null,title VARCHAR(255) null,description STRING null,changeLog VARCHAR(75) null,extraSettings TEXT null,fileEntryTypeId LONG,version VARCHAR(75) null,size_ LONG,status INTEGER,statusByUserId LONG,statusByUserName VARCHAR(75) null,statusDate DATE null)";
096            public static final String TABLE_SQL_DROP = "drop table DLFileVersion";
097            public static final String ORDER_BY_JPQL = " ORDER BY dlFileVersion.fileEntryId DESC, dlFileVersion.createDate DESC";
098            public static final String ORDER_BY_SQL = " ORDER BY DLFileVersion.fileEntryId DESC, DLFileVersion.createDate DESC";
099            public static final String DATA_SOURCE = "liferayDataSource";
100            public static final String SESSION_FACTORY = "liferaySessionFactory";
101            public static final String TX_MANAGER = "liferayTransactionManager";
102            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
103                                    "value.object.entity.cache.enabled.com.liferay.portlet.documentlibrary.model.DLFileVersion"),
104                            true);
105            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
106                                    "value.object.finder.cache.enabled.com.liferay.portlet.documentlibrary.model.DLFileVersion"),
107                            true);
108            public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
109                                    "value.object.column.bitmask.enabled.com.liferay.portlet.documentlibrary.model.DLFileVersion"),
110                            true);
111            public static long FILEENTRYID_COLUMN_BITMASK = 1L;
112            public static long FOLDERID_COLUMN_BITMASK = 2L;
113            public static long GROUPID_COLUMN_BITMASK = 4L;
114            public static long STATUS_COLUMN_BITMASK = 8L;
115            public static long TITLE_COLUMN_BITMASK = 16L;
116            public static long UUID_COLUMN_BITMASK = 32L;
117            public static long VERSION_COLUMN_BITMASK = 64L;
118    
119            /**
120             * Converts the soap model instance into a normal model instance.
121             *
122             * @param soapModel the soap model instance to convert
123             * @return the normal model instance
124             */
125            public static DLFileVersion toModel(DLFileVersionSoap soapModel) {
126                    if (soapModel == null) {
127                            return null;
128                    }
129    
130                    DLFileVersion model = new DLFileVersionImpl();
131    
132                    model.setUuid(soapModel.getUuid());
133                    model.setFileVersionId(soapModel.getFileVersionId());
134                    model.setGroupId(soapModel.getGroupId());
135                    model.setCompanyId(soapModel.getCompanyId());
136                    model.setUserId(soapModel.getUserId());
137                    model.setUserName(soapModel.getUserName());
138                    model.setCreateDate(soapModel.getCreateDate());
139                    model.setModifiedDate(soapModel.getModifiedDate());
140                    model.setRepositoryId(soapModel.getRepositoryId());
141                    model.setFolderId(soapModel.getFolderId());
142                    model.setFileEntryId(soapModel.getFileEntryId());
143                    model.setExtension(soapModel.getExtension());
144                    model.setMimeType(soapModel.getMimeType());
145                    model.setTitle(soapModel.getTitle());
146                    model.setDescription(soapModel.getDescription());
147                    model.setChangeLog(soapModel.getChangeLog());
148                    model.setExtraSettings(soapModel.getExtraSettings());
149                    model.setFileEntryTypeId(soapModel.getFileEntryTypeId());
150                    model.setVersion(soapModel.getVersion());
151                    model.setSize(soapModel.getSize());
152                    model.setStatus(soapModel.getStatus());
153                    model.setStatusByUserId(soapModel.getStatusByUserId());
154                    model.setStatusByUserName(soapModel.getStatusByUserName());
155                    model.setStatusDate(soapModel.getStatusDate());
156    
157                    return model;
158            }
159    
160            /**
161             * Converts the soap model instances into normal model instances.
162             *
163             * @param soapModels the soap model instances to convert
164             * @return the normal model instances
165             */
166            public static List<DLFileVersion> toModels(DLFileVersionSoap[] soapModels) {
167                    if (soapModels == null) {
168                            return null;
169                    }
170    
171                    List<DLFileVersion> models = new ArrayList<DLFileVersion>(soapModels.length);
172    
173                    for (DLFileVersionSoap soapModel : soapModels) {
174                            models.add(toModel(soapModel));
175                    }
176    
177                    return models;
178            }
179    
180            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
181                                    "lock.expiration.time.com.liferay.portlet.documentlibrary.model.DLFileVersion"));
182    
183            public DLFileVersionModelImpl() {
184            }
185    
186            public long getPrimaryKey() {
187                    return _fileVersionId;
188            }
189    
190            public void setPrimaryKey(long primaryKey) {
191                    setFileVersionId(primaryKey);
192            }
193    
194            public Serializable getPrimaryKeyObj() {
195                    return new Long(_fileVersionId);
196            }
197    
198            public void setPrimaryKeyObj(Serializable primaryKeyObj) {
199                    setPrimaryKey(((Long)primaryKeyObj).longValue());
200            }
201    
202            public Class<?> getModelClass() {
203                    return DLFileVersion.class;
204            }
205    
206            public String getModelClassName() {
207                    return DLFileVersion.class.getName();
208            }
209    
210            @Override
211            public Map<String, Object> getModelAttributes() {
212                    Map<String, Object> attributes = new HashMap<String, Object>();
213    
214                    attributes.put("uuid", getUuid());
215                    attributes.put("fileVersionId", getFileVersionId());
216                    attributes.put("groupId", getGroupId());
217                    attributes.put("companyId", getCompanyId());
218                    attributes.put("userId", getUserId());
219                    attributes.put("userName", getUserName());
220                    attributes.put("createDate", getCreateDate());
221                    attributes.put("modifiedDate", getModifiedDate());
222                    attributes.put("repositoryId", getRepositoryId());
223                    attributes.put("folderId", getFolderId());
224                    attributes.put("fileEntryId", getFileEntryId());
225                    attributes.put("extension", getExtension());
226                    attributes.put("mimeType", getMimeType());
227                    attributes.put("title", getTitle());
228                    attributes.put("description", getDescription());
229                    attributes.put("changeLog", getChangeLog());
230                    attributes.put("extraSettings", getExtraSettings());
231                    attributes.put("fileEntryTypeId", getFileEntryTypeId());
232                    attributes.put("version", getVersion());
233                    attributes.put("size", getSize());
234                    attributes.put("status", getStatus());
235                    attributes.put("statusByUserId", getStatusByUserId());
236                    attributes.put("statusByUserName", getStatusByUserName());
237                    attributes.put("statusDate", getStatusDate());
238    
239                    return attributes;
240            }
241    
242            @Override
243            public void setModelAttributes(Map<String, Object> attributes) {
244                    String uuid = (String)attributes.get("uuid");
245    
246                    if (uuid != null) {
247                            setUuid(uuid);
248                    }
249    
250                    Long fileVersionId = (Long)attributes.get("fileVersionId");
251    
252                    if (fileVersionId != null) {
253                            setFileVersionId(fileVersionId);
254                    }
255    
256                    Long groupId = (Long)attributes.get("groupId");
257    
258                    if (groupId != null) {
259                            setGroupId(groupId);
260                    }
261    
262                    Long companyId = (Long)attributes.get("companyId");
263    
264                    if (companyId != null) {
265                            setCompanyId(companyId);
266                    }
267    
268                    Long userId = (Long)attributes.get("userId");
269    
270                    if (userId != null) {
271                            setUserId(userId);
272                    }
273    
274                    String userName = (String)attributes.get("userName");
275    
276                    if (userName != null) {
277                            setUserName(userName);
278                    }
279    
280                    Date createDate = (Date)attributes.get("createDate");
281    
282                    if (createDate != null) {
283                            setCreateDate(createDate);
284                    }
285    
286                    Date modifiedDate = (Date)attributes.get("modifiedDate");
287    
288                    if (modifiedDate != null) {
289                            setModifiedDate(modifiedDate);
290                    }
291    
292                    Long repositoryId = (Long)attributes.get("repositoryId");
293    
294                    if (repositoryId != null) {
295                            setRepositoryId(repositoryId);
296                    }
297    
298                    Long folderId = (Long)attributes.get("folderId");
299    
300                    if (folderId != null) {
301                            setFolderId(folderId);
302                    }
303    
304                    Long fileEntryId = (Long)attributes.get("fileEntryId");
305    
306                    if (fileEntryId != null) {
307                            setFileEntryId(fileEntryId);
308                    }
309    
310                    String extension = (String)attributes.get("extension");
311    
312                    if (extension != null) {
313                            setExtension(extension);
314                    }
315    
316                    String mimeType = (String)attributes.get("mimeType");
317    
318                    if (mimeType != null) {
319                            setMimeType(mimeType);
320                    }
321    
322                    String title = (String)attributes.get("title");
323    
324                    if (title != null) {
325                            setTitle(title);
326                    }
327    
328                    String description = (String)attributes.get("description");
329    
330                    if (description != null) {
331                            setDescription(description);
332                    }
333    
334                    String changeLog = (String)attributes.get("changeLog");
335    
336                    if (changeLog != null) {
337                            setChangeLog(changeLog);
338                    }
339    
340                    String extraSettings = (String)attributes.get("extraSettings");
341    
342                    if (extraSettings != null) {
343                            setExtraSettings(extraSettings);
344                    }
345    
346                    Long fileEntryTypeId = (Long)attributes.get("fileEntryTypeId");
347    
348                    if (fileEntryTypeId != null) {
349                            setFileEntryTypeId(fileEntryTypeId);
350                    }
351    
352                    String version = (String)attributes.get("version");
353    
354                    if (version != null) {
355                            setVersion(version);
356                    }
357    
358                    Long size = (Long)attributes.get("size");
359    
360                    if (size != null) {
361                            setSize(size);
362                    }
363    
364                    Integer status = (Integer)attributes.get("status");
365    
366                    if (status != null) {
367                            setStatus(status);
368                    }
369    
370                    Long statusByUserId = (Long)attributes.get("statusByUserId");
371    
372                    if (statusByUserId != null) {
373                            setStatusByUserId(statusByUserId);
374                    }
375    
376                    String statusByUserName = (String)attributes.get("statusByUserName");
377    
378                    if (statusByUserName != null) {
379                            setStatusByUserName(statusByUserName);
380                    }
381    
382                    Date statusDate = (Date)attributes.get("statusDate");
383    
384                    if (statusDate != null) {
385                            setStatusDate(statusDate);
386                    }
387            }
388    
389            @JSON
390            public String getUuid() {
391                    if (_uuid == null) {
392                            return StringPool.BLANK;
393                    }
394                    else {
395                            return _uuid;
396                    }
397            }
398    
399            public void setUuid(String uuid) {
400                    if (_originalUuid == null) {
401                            _originalUuid = _uuid;
402                    }
403    
404                    _uuid = uuid;
405            }
406    
407            public String getOriginalUuid() {
408                    return GetterUtil.getString(_originalUuid);
409            }
410    
411            @JSON
412            public long getFileVersionId() {
413                    return _fileVersionId;
414            }
415    
416            public void setFileVersionId(long fileVersionId) {
417                    _fileVersionId = fileVersionId;
418            }
419    
420            @JSON
421            public long getGroupId() {
422                    return _groupId;
423            }
424    
425            public void setGroupId(long groupId) {
426                    _columnBitmask |= GROUPID_COLUMN_BITMASK;
427    
428                    if (!_setOriginalGroupId) {
429                            _setOriginalGroupId = true;
430    
431                            _originalGroupId = _groupId;
432                    }
433    
434                    _groupId = groupId;
435            }
436    
437            public long getOriginalGroupId() {
438                    return _originalGroupId;
439            }
440    
441            @JSON
442            public long getCompanyId() {
443                    return _companyId;
444            }
445    
446            public void setCompanyId(long companyId) {
447                    _companyId = companyId;
448            }
449    
450            @JSON
451            public long getUserId() {
452                    return _userId;
453            }
454    
455            public void setUserId(long userId) {
456                    _userId = userId;
457            }
458    
459            public String getUserUuid() throws SystemException {
460                    return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
461            }
462    
463            public void setUserUuid(String userUuid) {
464                    _userUuid = userUuid;
465            }
466    
467            @JSON
468            public String getUserName() {
469                    if (_userName == null) {
470                            return StringPool.BLANK;
471                    }
472                    else {
473                            return _userName;
474                    }
475            }
476    
477            public void setUserName(String userName) {
478                    _userName = userName;
479            }
480    
481            @JSON
482            public Date getCreateDate() {
483                    return _createDate;
484            }
485    
486            public void setCreateDate(Date createDate) {
487                    _columnBitmask = -1L;
488    
489                    _createDate = createDate;
490            }
491    
492            @JSON
493            public Date getModifiedDate() {
494                    return _modifiedDate;
495            }
496    
497            public void setModifiedDate(Date modifiedDate) {
498                    _modifiedDate = modifiedDate;
499            }
500    
501            @JSON
502            public long getRepositoryId() {
503                    return _repositoryId;
504            }
505    
506            public void setRepositoryId(long repositoryId) {
507                    _repositoryId = repositoryId;
508            }
509    
510            @JSON
511            public long getFolderId() {
512                    return _folderId;
513            }
514    
515            public void setFolderId(long folderId) {
516                    _columnBitmask |= FOLDERID_COLUMN_BITMASK;
517    
518                    if (!_setOriginalFolderId) {
519                            _setOriginalFolderId = true;
520    
521                            _originalFolderId = _folderId;
522                    }
523    
524                    _folderId = folderId;
525            }
526    
527            public long getOriginalFolderId() {
528                    return _originalFolderId;
529            }
530    
531            @JSON
532            public long getFileEntryId() {
533                    return _fileEntryId;
534            }
535    
536            public void setFileEntryId(long fileEntryId) {
537                    _columnBitmask = -1L;
538    
539                    if (!_setOriginalFileEntryId) {
540                            _setOriginalFileEntryId = true;
541    
542                            _originalFileEntryId = _fileEntryId;
543                    }
544    
545                    _fileEntryId = fileEntryId;
546            }
547    
548            public long getOriginalFileEntryId() {
549                    return _originalFileEntryId;
550            }
551    
552            @JSON
553            public String getExtension() {
554                    if (_extension == null) {
555                            return StringPool.BLANK;
556                    }
557                    else {
558                            return _extension;
559                    }
560            }
561    
562            public void setExtension(String extension) {
563                    _extension = extension;
564            }
565    
566            @JSON
567            public String getMimeType() {
568                    if (_mimeType == null) {
569                            return StringPool.BLANK;
570                    }
571                    else {
572                            return _mimeType;
573                    }
574            }
575    
576            public void setMimeType(String mimeType) {
577                    _mimeType = mimeType;
578            }
579    
580            @JSON
581            public String getTitle() {
582                    if (_title == null) {
583                            return StringPool.BLANK;
584                    }
585                    else {
586                            return _title;
587                    }
588            }
589    
590            public void setTitle(String title) {
591                    _columnBitmask |= TITLE_COLUMN_BITMASK;
592    
593                    if (_originalTitle == null) {
594                            _originalTitle = _title;
595                    }
596    
597                    _title = title;
598            }
599    
600            public String getOriginalTitle() {
601                    return GetterUtil.getString(_originalTitle);
602            }
603    
604            @JSON
605            public String getDescription() {
606                    if (_description == null) {
607                            return StringPool.BLANK;
608                    }
609                    else {
610                            return _description;
611                    }
612            }
613    
614            public void setDescription(String description) {
615                    _description = description;
616            }
617    
618            @JSON
619            public String getChangeLog() {
620                    if (_changeLog == null) {
621                            return StringPool.BLANK;
622                    }
623                    else {
624                            return _changeLog;
625                    }
626            }
627    
628            public void setChangeLog(String changeLog) {
629                    _changeLog = changeLog;
630            }
631    
632            @JSON
633            public String getExtraSettings() {
634                    if (_extraSettings == null) {
635                            return StringPool.BLANK;
636                    }
637                    else {
638                            return _extraSettings;
639                    }
640            }
641    
642            public void setExtraSettings(String extraSettings) {
643                    _extraSettings = extraSettings;
644            }
645    
646            @JSON
647            public long getFileEntryTypeId() {
648                    return _fileEntryTypeId;
649            }
650    
651            public void setFileEntryTypeId(long fileEntryTypeId) {
652                    _fileEntryTypeId = fileEntryTypeId;
653            }
654    
655            @JSON
656            public String getVersion() {
657                    if (_version == null) {
658                            return StringPool.BLANK;
659                    }
660                    else {
661                            return _version;
662                    }
663            }
664    
665            public void setVersion(String version) {
666                    _columnBitmask |= VERSION_COLUMN_BITMASK;
667    
668                    if (_originalVersion == null) {
669                            _originalVersion = _version;
670                    }
671    
672                    _version = version;
673            }
674    
675            public String getOriginalVersion() {
676                    return GetterUtil.getString(_originalVersion);
677            }
678    
679            @JSON
680            public long getSize() {
681                    return _size;
682            }
683    
684            public void setSize(long size) {
685                    _size = size;
686            }
687    
688            @JSON
689            public int getStatus() {
690                    return _status;
691            }
692    
693            public void setStatus(int status) {
694                    _columnBitmask |= STATUS_COLUMN_BITMASK;
695    
696                    if (!_setOriginalStatus) {
697                            _setOriginalStatus = true;
698    
699                            _originalStatus = _status;
700                    }
701    
702                    _status = status;
703            }
704    
705            public int getOriginalStatus() {
706                    return _originalStatus;
707            }
708    
709            @JSON
710            public long getStatusByUserId() {
711                    return _statusByUserId;
712            }
713    
714            public void setStatusByUserId(long statusByUserId) {
715                    _statusByUserId = statusByUserId;
716            }
717    
718            public String getStatusByUserUuid() throws SystemException {
719                    return PortalUtil.getUserValue(getStatusByUserId(), "uuid",
720                            _statusByUserUuid);
721            }
722    
723            public void setStatusByUserUuid(String statusByUserUuid) {
724                    _statusByUserUuid = statusByUserUuid;
725            }
726    
727            @JSON
728            public String getStatusByUserName() {
729                    if (_statusByUserName == null) {
730                            return StringPool.BLANK;
731                    }
732                    else {
733                            return _statusByUserName;
734                    }
735            }
736    
737            public void setStatusByUserName(String statusByUserName) {
738                    _statusByUserName = statusByUserName;
739            }
740    
741            @JSON
742            public Date getStatusDate() {
743                    return _statusDate;
744            }
745    
746            public void setStatusDate(Date statusDate) {
747                    _statusDate = statusDate;
748            }
749    
750            /**
751             * @deprecated {@link #isApproved}
752             */
753            public boolean getApproved() {
754                    return isApproved();
755            }
756    
757            public boolean isApproved() {
758                    if (getStatus() == WorkflowConstants.STATUS_APPROVED) {
759                            return true;
760                    }
761                    else {
762                            return false;
763                    }
764            }
765    
766            public boolean isDenied() {
767                    if (getStatus() == WorkflowConstants.STATUS_DENIED) {
768                            return true;
769                    }
770                    else {
771                            return false;
772                    }
773            }
774    
775            public boolean isDraft() {
776                    if ((getStatus() == WorkflowConstants.STATUS_DRAFT) ||
777                                    (getStatus() == WorkflowConstants.STATUS_DRAFT_FROM_APPROVED)) {
778                            return true;
779                    }
780                    else {
781                            return false;
782                    }
783            }
784    
785            public boolean isExpired() {
786                    if (getStatus() == WorkflowConstants.STATUS_EXPIRED) {
787                            return true;
788                    }
789                    else {
790                            return false;
791                    }
792            }
793    
794            public boolean isInactive() {
795                    if (getStatus() == WorkflowConstants.STATUS_INACTIVE) {
796                            return true;
797                    }
798                    else {
799                            return false;
800                    }
801            }
802    
803            public boolean isIncomplete() {
804                    if (getStatus() == WorkflowConstants.STATUS_INCOMPLETE) {
805                            return true;
806                    }
807                    else {
808                            return false;
809                    }
810            }
811    
812            public boolean isPending() {
813                    if (getStatus() == WorkflowConstants.STATUS_PENDING) {
814                            return true;
815                    }
816                    else {
817                            return false;
818                    }
819            }
820    
821            public boolean isScheduled() {
822                    if (getStatus() == WorkflowConstants.STATUS_SCHEDULED) {
823                            return true;
824                    }
825                    else {
826                            return false;
827                    }
828            }
829    
830            public long getColumnBitmask() {
831                    return _columnBitmask;
832            }
833    
834            @Override
835            public ExpandoBridge getExpandoBridge() {
836                    return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
837                            DLFileVersion.class.getName(), getPrimaryKey());
838            }
839    
840            @Override
841            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
842                    ExpandoBridge expandoBridge = getExpandoBridge();
843    
844                    expandoBridge.setAttributes(serviceContext);
845            }
846    
847            @Override
848            public DLFileVersion toEscapedModel() {
849                    if (_escapedModelProxy == null) {
850                            _escapedModelProxy = (DLFileVersion)ProxyUtil.newProxyInstance(_classLoader,
851                                            _escapedModelProxyInterfaces,
852                                            new AutoEscapeBeanHandler(this));
853                    }
854    
855                    return _escapedModelProxy;
856            }
857    
858            @Override
859            public Object clone() {
860                    DLFileVersionImpl dlFileVersionImpl = new DLFileVersionImpl();
861    
862                    dlFileVersionImpl.setUuid(getUuid());
863                    dlFileVersionImpl.setFileVersionId(getFileVersionId());
864                    dlFileVersionImpl.setGroupId(getGroupId());
865                    dlFileVersionImpl.setCompanyId(getCompanyId());
866                    dlFileVersionImpl.setUserId(getUserId());
867                    dlFileVersionImpl.setUserName(getUserName());
868                    dlFileVersionImpl.setCreateDate(getCreateDate());
869                    dlFileVersionImpl.setModifiedDate(getModifiedDate());
870                    dlFileVersionImpl.setRepositoryId(getRepositoryId());
871                    dlFileVersionImpl.setFolderId(getFolderId());
872                    dlFileVersionImpl.setFileEntryId(getFileEntryId());
873                    dlFileVersionImpl.setExtension(getExtension());
874                    dlFileVersionImpl.setMimeType(getMimeType());
875                    dlFileVersionImpl.setTitle(getTitle());
876                    dlFileVersionImpl.setDescription(getDescription());
877                    dlFileVersionImpl.setChangeLog(getChangeLog());
878                    dlFileVersionImpl.setExtraSettings(getExtraSettings());
879                    dlFileVersionImpl.setFileEntryTypeId(getFileEntryTypeId());
880                    dlFileVersionImpl.setVersion(getVersion());
881                    dlFileVersionImpl.setSize(getSize());
882                    dlFileVersionImpl.setStatus(getStatus());
883                    dlFileVersionImpl.setStatusByUserId(getStatusByUserId());
884                    dlFileVersionImpl.setStatusByUserName(getStatusByUserName());
885                    dlFileVersionImpl.setStatusDate(getStatusDate());
886    
887                    dlFileVersionImpl.resetOriginalValues();
888    
889                    return dlFileVersionImpl;
890            }
891    
892            public int compareTo(DLFileVersion dlFileVersion) {
893                    int value = 0;
894    
895                    if (getFileEntryId() < dlFileVersion.getFileEntryId()) {
896                            value = -1;
897                    }
898                    else if (getFileEntryId() > dlFileVersion.getFileEntryId()) {
899                            value = 1;
900                    }
901                    else {
902                            value = 0;
903                    }
904    
905                    value = value * -1;
906    
907                    if (value != 0) {
908                            return value;
909                    }
910    
911                    value = DateUtil.compareTo(getCreateDate(),
912                                    dlFileVersion.getCreateDate());
913    
914                    value = value * -1;
915    
916                    if (value != 0) {
917                            return value;
918                    }
919    
920                    return 0;
921            }
922    
923            @Override
924            public boolean equals(Object obj) {
925                    if (obj == null) {
926                            return false;
927                    }
928    
929                    DLFileVersion dlFileVersion = null;
930    
931                    try {
932                            dlFileVersion = (DLFileVersion)obj;
933                    }
934                    catch (ClassCastException cce) {
935                            return false;
936                    }
937    
938                    long primaryKey = dlFileVersion.getPrimaryKey();
939    
940                    if (getPrimaryKey() == primaryKey) {
941                            return true;
942                    }
943                    else {
944                            return false;
945                    }
946            }
947    
948            @Override
949            public int hashCode() {
950                    return (int)getPrimaryKey();
951            }
952    
953            @Override
954            public void resetOriginalValues() {
955                    DLFileVersionModelImpl dlFileVersionModelImpl = this;
956    
957                    dlFileVersionModelImpl._originalUuid = dlFileVersionModelImpl._uuid;
958    
959                    dlFileVersionModelImpl._originalGroupId = dlFileVersionModelImpl._groupId;
960    
961                    dlFileVersionModelImpl._setOriginalGroupId = false;
962    
963                    dlFileVersionModelImpl._originalFolderId = dlFileVersionModelImpl._folderId;
964    
965                    dlFileVersionModelImpl._setOriginalFolderId = false;
966    
967                    dlFileVersionModelImpl._originalFileEntryId = dlFileVersionModelImpl._fileEntryId;
968    
969                    dlFileVersionModelImpl._setOriginalFileEntryId = false;
970    
971                    dlFileVersionModelImpl._originalTitle = dlFileVersionModelImpl._title;
972    
973                    dlFileVersionModelImpl._originalVersion = dlFileVersionModelImpl._version;
974    
975                    dlFileVersionModelImpl._originalStatus = dlFileVersionModelImpl._status;
976    
977                    dlFileVersionModelImpl._setOriginalStatus = false;
978    
979                    dlFileVersionModelImpl._columnBitmask = 0;
980            }
981    
982            @Override
983            public CacheModel<DLFileVersion> toCacheModel() {
984                    DLFileVersionCacheModel dlFileVersionCacheModel = new DLFileVersionCacheModel();
985    
986                    dlFileVersionCacheModel.uuid = getUuid();
987    
988                    String uuid = dlFileVersionCacheModel.uuid;
989    
990                    if ((uuid != null) && (uuid.length() == 0)) {
991                            dlFileVersionCacheModel.uuid = null;
992                    }
993    
994                    dlFileVersionCacheModel.fileVersionId = getFileVersionId();
995    
996                    dlFileVersionCacheModel.groupId = getGroupId();
997    
998                    dlFileVersionCacheModel.companyId = getCompanyId();
999    
1000                    dlFileVersionCacheModel.userId = getUserId();
1001    
1002                    dlFileVersionCacheModel.userName = getUserName();
1003    
1004                    String userName = dlFileVersionCacheModel.userName;
1005    
1006                    if ((userName != null) && (userName.length() == 0)) {
1007                            dlFileVersionCacheModel.userName = null;
1008                    }
1009    
1010                    Date createDate = getCreateDate();
1011    
1012                    if (createDate != null) {
1013                            dlFileVersionCacheModel.createDate = createDate.getTime();
1014                    }
1015                    else {
1016                            dlFileVersionCacheModel.createDate = Long.MIN_VALUE;
1017                    }
1018    
1019                    Date modifiedDate = getModifiedDate();
1020    
1021                    if (modifiedDate != null) {
1022                            dlFileVersionCacheModel.modifiedDate = modifiedDate.getTime();
1023                    }
1024                    else {
1025                            dlFileVersionCacheModel.modifiedDate = Long.MIN_VALUE;
1026                    }
1027    
1028                    dlFileVersionCacheModel.repositoryId = getRepositoryId();
1029    
1030                    dlFileVersionCacheModel.folderId = getFolderId();
1031    
1032                    dlFileVersionCacheModel.fileEntryId = getFileEntryId();
1033    
1034                    dlFileVersionCacheModel.extension = getExtension();
1035    
1036                    String extension = dlFileVersionCacheModel.extension;
1037    
1038                    if ((extension != null) && (extension.length() == 0)) {
1039                            dlFileVersionCacheModel.extension = null;
1040                    }
1041    
1042                    dlFileVersionCacheModel.mimeType = getMimeType();
1043    
1044                    String mimeType = dlFileVersionCacheModel.mimeType;
1045    
1046                    if ((mimeType != null) && (mimeType.length() == 0)) {
1047                            dlFileVersionCacheModel.mimeType = null;
1048                    }
1049    
1050                    dlFileVersionCacheModel.title = getTitle();
1051    
1052                    String title = dlFileVersionCacheModel.title;
1053    
1054                    if ((title != null) && (title.length() == 0)) {
1055                            dlFileVersionCacheModel.title = null;
1056                    }
1057    
1058                    dlFileVersionCacheModel.description = getDescription();
1059    
1060                    String description = dlFileVersionCacheModel.description;
1061    
1062                    if ((description != null) && (description.length() == 0)) {
1063                            dlFileVersionCacheModel.description = null;
1064                    }
1065    
1066                    dlFileVersionCacheModel.changeLog = getChangeLog();
1067    
1068                    String changeLog = dlFileVersionCacheModel.changeLog;
1069    
1070                    if ((changeLog != null) && (changeLog.length() == 0)) {
1071                            dlFileVersionCacheModel.changeLog = null;
1072                    }
1073    
1074                    dlFileVersionCacheModel.extraSettings = getExtraSettings();
1075    
1076                    String extraSettings = dlFileVersionCacheModel.extraSettings;
1077    
1078                    if ((extraSettings != null) && (extraSettings.length() == 0)) {
1079                            dlFileVersionCacheModel.extraSettings = null;
1080                    }
1081    
1082                    dlFileVersionCacheModel.fileEntryTypeId = getFileEntryTypeId();
1083    
1084                    dlFileVersionCacheModel.version = getVersion();
1085    
1086                    String version = dlFileVersionCacheModel.version;
1087    
1088                    if ((version != null) && (version.length() == 0)) {
1089                            dlFileVersionCacheModel.version = null;
1090                    }
1091    
1092                    dlFileVersionCacheModel.size = getSize();
1093    
1094                    dlFileVersionCacheModel.status = getStatus();
1095    
1096                    dlFileVersionCacheModel.statusByUserId = getStatusByUserId();
1097    
1098                    dlFileVersionCacheModel.statusByUserName = getStatusByUserName();
1099    
1100                    String statusByUserName = dlFileVersionCacheModel.statusByUserName;
1101    
1102                    if ((statusByUserName != null) && (statusByUserName.length() == 0)) {
1103                            dlFileVersionCacheModel.statusByUserName = null;
1104                    }
1105    
1106                    Date statusDate = getStatusDate();
1107    
1108                    if (statusDate != null) {
1109                            dlFileVersionCacheModel.statusDate = statusDate.getTime();
1110                    }
1111                    else {
1112                            dlFileVersionCacheModel.statusDate = Long.MIN_VALUE;
1113                    }
1114    
1115                    return dlFileVersionCacheModel;
1116            }
1117    
1118            @Override
1119            public String toString() {
1120                    StringBundler sb = new StringBundler(49);
1121    
1122                    sb.append("{uuid=");
1123                    sb.append(getUuid());
1124                    sb.append(", fileVersionId=");
1125                    sb.append(getFileVersionId());
1126                    sb.append(", groupId=");
1127                    sb.append(getGroupId());
1128                    sb.append(", companyId=");
1129                    sb.append(getCompanyId());
1130                    sb.append(", userId=");
1131                    sb.append(getUserId());
1132                    sb.append(", userName=");
1133                    sb.append(getUserName());
1134                    sb.append(", createDate=");
1135                    sb.append(getCreateDate());
1136                    sb.append(", modifiedDate=");
1137                    sb.append(getModifiedDate());
1138                    sb.append(", repositoryId=");
1139                    sb.append(getRepositoryId());
1140                    sb.append(", folderId=");
1141                    sb.append(getFolderId());
1142                    sb.append(", fileEntryId=");
1143                    sb.append(getFileEntryId());
1144                    sb.append(", extension=");
1145                    sb.append(getExtension());
1146                    sb.append(", mimeType=");
1147                    sb.append(getMimeType());
1148                    sb.append(", title=");
1149                    sb.append(getTitle());
1150                    sb.append(", description=");
1151                    sb.append(getDescription());
1152                    sb.append(", changeLog=");
1153                    sb.append(getChangeLog());
1154                    sb.append(", extraSettings=");
1155                    sb.append(getExtraSettings());
1156                    sb.append(", fileEntryTypeId=");
1157                    sb.append(getFileEntryTypeId());
1158                    sb.append(", version=");
1159                    sb.append(getVersion());
1160                    sb.append(", size=");
1161                    sb.append(getSize());
1162                    sb.append(", status=");
1163                    sb.append(getStatus());
1164                    sb.append(", statusByUserId=");
1165                    sb.append(getStatusByUserId());
1166                    sb.append(", statusByUserName=");
1167                    sb.append(getStatusByUserName());
1168                    sb.append(", statusDate=");
1169                    sb.append(getStatusDate());
1170                    sb.append("}");
1171    
1172                    return sb.toString();
1173            }
1174    
1175            public String toXmlString() {
1176                    StringBundler sb = new StringBundler(76);
1177    
1178                    sb.append("<model><model-name>");
1179                    sb.append("com.liferay.portlet.documentlibrary.model.DLFileVersion");
1180                    sb.append("</model-name>");
1181    
1182                    sb.append(
1183                            "<column><column-name>uuid</column-name><column-value><![CDATA[");
1184                    sb.append(getUuid());
1185                    sb.append("]]></column-value></column>");
1186                    sb.append(
1187                            "<column><column-name>fileVersionId</column-name><column-value><![CDATA[");
1188                    sb.append(getFileVersionId());
1189                    sb.append("]]></column-value></column>");
1190                    sb.append(
1191                            "<column><column-name>groupId</column-name><column-value><![CDATA[");
1192                    sb.append(getGroupId());
1193                    sb.append("]]></column-value></column>");
1194                    sb.append(
1195                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
1196                    sb.append(getCompanyId());
1197                    sb.append("]]></column-value></column>");
1198                    sb.append(
1199                            "<column><column-name>userId</column-name><column-value><![CDATA[");
1200                    sb.append(getUserId());
1201                    sb.append("]]></column-value></column>");
1202                    sb.append(
1203                            "<column><column-name>userName</column-name><column-value><![CDATA[");
1204                    sb.append(getUserName());
1205                    sb.append("]]></column-value></column>");
1206                    sb.append(
1207                            "<column><column-name>createDate</column-name><column-value><![CDATA[");
1208                    sb.append(getCreateDate());
1209                    sb.append("]]></column-value></column>");
1210                    sb.append(
1211                            "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
1212                    sb.append(getModifiedDate());
1213                    sb.append("]]></column-value></column>");
1214                    sb.append(
1215                            "<column><column-name>repositoryId</column-name><column-value><![CDATA[");
1216                    sb.append(getRepositoryId());
1217                    sb.append("]]></column-value></column>");
1218                    sb.append(
1219                            "<column><column-name>folderId</column-name><column-value><![CDATA[");
1220                    sb.append(getFolderId());
1221                    sb.append("]]></column-value></column>");
1222                    sb.append(
1223                            "<column><column-name>fileEntryId</column-name><column-value><![CDATA[");
1224                    sb.append(getFileEntryId());
1225                    sb.append("]]></column-value></column>");
1226                    sb.append(
1227                            "<column><column-name>extension</column-name><column-value><![CDATA[");
1228                    sb.append(getExtension());
1229                    sb.append("]]></column-value></column>");
1230                    sb.append(
1231                            "<column><column-name>mimeType</column-name><column-value><![CDATA[");
1232                    sb.append(getMimeType());
1233                    sb.append("]]></column-value></column>");
1234                    sb.append(
1235                            "<column><column-name>title</column-name><column-value><![CDATA[");
1236                    sb.append(getTitle());
1237                    sb.append("]]></column-value></column>");
1238                    sb.append(
1239                            "<column><column-name>description</column-name><column-value><![CDATA[");
1240                    sb.append(getDescription());
1241                    sb.append("]]></column-value></column>");
1242                    sb.append(
1243                            "<column><column-name>changeLog</column-name><column-value><![CDATA[");
1244                    sb.append(getChangeLog());
1245                    sb.append("]]></column-value></column>");
1246                    sb.append(
1247                            "<column><column-name>extraSettings</column-name><column-value><![CDATA[");
1248                    sb.append(getExtraSettings());
1249                    sb.append("]]></column-value></column>");
1250                    sb.append(
1251                            "<column><column-name>fileEntryTypeId</column-name><column-value><![CDATA[");
1252                    sb.append(getFileEntryTypeId());
1253                    sb.append("]]></column-value></column>");
1254                    sb.append(
1255                            "<column><column-name>version</column-name><column-value><![CDATA[");
1256                    sb.append(getVersion());
1257                    sb.append("]]></column-value></column>");
1258                    sb.append(
1259                            "<column><column-name>size</column-name><column-value><![CDATA[");
1260                    sb.append(getSize());
1261                    sb.append("]]></column-value></column>");
1262                    sb.append(
1263                            "<column><column-name>status</column-name><column-value><![CDATA[");
1264                    sb.append(getStatus());
1265                    sb.append("]]></column-value></column>");
1266                    sb.append(
1267                            "<column><column-name>statusByUserId</column-name><column-value><![CDATA[");
1268                    sb.append(getStatusByUserId());
1269                    sb.append("]]></column-value></column>");
1270                    sb.append(
1271                            "<column><column-name>statusByUserName</column-name><column-value><![CDATA[");
1272                    sb.append(getStatusByUserName());
1273                    sb.append("]]></column-value></column>");
1274                    sb.append(
1275                            "<column><column-name>statusDate</column-name><column-value><![CDATA[");
1276                    sb.append(getStatusDate());
1277                    sb.append("]]></column-value></column>");
1278    
1279                    sb.append("</model>");
1280    
1281                    return sb.toString();
1282            }
1283    
1284            private static ClassLoader _classLoader = DLFileVersion.class.getClassLoader();
1285            private static Class<?>[] _escapedModelProxyInterfaces = new Class[] {
1286                            DLFileVersion.class
1287                    };
1288            private String _uuid;
1289            private String _originalUuid;
1290            private long _fileVersionId;
1291            private long _groupId;
1292            private long _originalGroupId;
1293            private boolean _setOriginalGroupId;
1294            private long _companyId;
1295            private long _userId;
1296            private String _userUuid;
1297            private String _userName;
1298            private Date _createDate;
1299            private Date _modifiedDate;
1300            private long _repositoryId;
1301            private long _folderId;
1302            private long _originalFolderId;
1303            private boolean _setOriginalFolderId;
1304            private long _fileEntryId;
1305            private long _originalFileEntryId;
1306            private boolean _setOriginalFileEntryId;
1307            private String _extension;
1308            private String _mimeType;
1309            private String _title;
1310            private String _originalTitle;
1311            private String _description;
1312            private String _changeLog;
1313            private String _extraSettings;
1314            private long _fileEntryTypeId;
1315            private String _version;
1316            private String _originalVersion;
1317            private long _size;
1318            private int _status;
1319            private int _originalStatus;
1320            private boolean _setOriginalStatus;
1321            private long _statusByUserId;
1322            private String _statusByUserUuid;
1323            private String _statusByUserName;
1324            private Date _statusDate;
1325            private long _columnBitmask;
1326            private DLFileVersion _escapedModelProxy;
1327    }