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