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