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