001    /**
002     * Copyright (c) 2000-2010 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.util.GetterUtil;
020    import com.liferay.portal.kernel.util.StringBundler;
021    import com.liferay.portal.kernel.util.StringPool;
022    import com.liferay.portal.model.impl.BaseModelImpl;
023    import com.liferay.portal.service.ServiceContext;
024    import com.liferay.portal.util.PortalUtil;
025    
026    import com.liferay.portlet.documentlibrary.model.DLFileEntry;
027    import com.liferay.portlet.documentlibrary.model.DLFileEntryModel;
028    import com.liferay.portlet.documentlibrary.model.DLFileEntrySoap;
029    import com.liferay.portlet.expando.model.ExpandoBridge;
030    import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
031    
032    import java.io.Serializable;
033    
034    import java.lang.reflect.Proxy;
035    
036    import java.sql.Types;
037    
038    import java.util.ArrayList;
039    import java.util.Date;
040    import java.util.List;
041    
042    /**
043     * The base model implementation for the DLFileEntry service. Represents a row in the "DLFileEntry" database table, with each column mapped to a property of this class.
044     *
045     * <p>
046     * This implementation and its corresponding interface {@link com.liferay.portlet.documentlibrary.model.DLFileEntryModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link DLFileEntryImpl}.
047     * </p>
048     *
049     * <p>
050     * Never modify or reference this class directly. All methods that expect a d l file entry model instance should use the {@link com.liferay.portlet.documentlibrary.model.DLFileEntry} interface instead.
051     * </p>
052     *
053     * @author Brian Wing Shun Chan
054     * @see DLFileEntryImpl
055     * @see com.liferay.portlet.documentlibrary.model.DLFileEntry
056     * @see com.liferay.portlet.documentlibrary.model.DLFileEntryModel
057     * @generated
058     */
059    public class DLFileEntryModelImpl extends BaseModelImpl<DLFileEntry>
060            implements DLFileEntryModel {
061            public static final String TABLE_NAME = "DLFileEntry";
062            public static final Object[][] TABLE_COLUMNS = {
063                            { "uuid_", new Integer(Types.VARCHAR) },
064                            { "fileEntryId", new Integer(Types.BIGINT) },
065                            { "groupId", new Integer(Types.BIGINT) },
066                            { "companyId", new Integer(Types.BIGINT) },
067                            { "userId", new Integer(Types.BIGINT) },
068                            { "userName", new Integer(Types.VARCHAR) },
069                            { "versionUserId", new Integer(Types.BIGINT) },
070                            { "versionUserName", new Integer(Types.VARCHAR) },
071                            { "createDate", new Integer(Types.TIMESTAMP) },
072                            { "modifiedDate", new Integer(Types.TIMESTAMP) },
073                            { "folderId", new Integer(Types.BIGINT) },
074                            { "name", new Integer(Types.VARCHAR) },
075                            { "extension", new Integer(Types.VARCHAR) },
076                            { "title", new Integer(Types.VARCHAR) },
077                            { "description", new Integer(Types.VARCHAR) },
078                            { "extraSettings", new Integer(Types.CLOB) },
079                            { "version", new Integer(Types.VARCHAR) },
080                            { "size_", new Integer(Types.BIGINT) },
081                            { "readCount", new Integer(Types.INTEGER) }
082                    };
083            public static final String TABLE_SQL_CREATE = "create table DLFileEntry (uuid_ VARCHAR(75) null,fileEntryId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,versionUserId LONG,versionUserName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,folderId LONG,name VARCHAR(255) null,extension VARCHAR(75) null,title VARCHAR(255) null,description STRING null,extraSettings TEXT null,version VARCHAR(75) null,size_ LONG,readCount INTEGER)";
084            public static final String TABLE_SQL_DROP = "drop table DLFileEntry";
085            public static final String ORDER_BY_JPQL = " ORDER BY dlFileEntry.folderId ASC, dlFileEntry.name ASC";
086            public static final String ORDER_BY_SQL = " ORDER BY DLFileEntry.folderId ASC, DLFileEntry.name ASC";
087            public static final String DATA_SOURCE = "liferayDataSource";
088            public static final String SESSION_FACTORY = "liferaySessionFactory";
089            public static final String TX_MANAGER = "liferayTransactionManager";
090            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
091                                    "value.object.entity.cache.enabled.com.liferay.portlet.documentlibrary.model.DLFileEntry"),
092                            true);
093            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
094                                    "value.object.finder.cache.enabled.com.liferay.portlet.documentlibrary.model.DLFileEntry"),
095                            true);
096    
097            /**
098             * Converts the soap model instance into a normal model instance.
099             *
100             * @param soapModel the soap model instance to convert
101             * @return the normal model instance
102             */
103            public static DLFileEntry toModel(DLFileEntrySoap soapModel) {
104                    DLFileEntry model = new DLFileEntryImpl();
105    
106                    model.setUuid(soapModel.getUuid());
107                    model.setFileEntryId(soapModel.getFileEntryId());
108                    model.setGroupId(soapModel.getGroupId());
109                    model.setCompanyId(soapModel.getCompanyId());
110                    model.setUserId(soapModel.getUserId());
111                    model.setUserName(soapModel.getUserName());
112                    model.setVersionUserId(soapModel.getVersionUserId());
113                    model.setVersionUserName(soapModel.getVersionUserName());
114                    model.setCreateDate(soapModel.getCreateDate());
115                    model.setModifiedDate(soapModel.getModifiedDate());
116                    model.setFolderId(soapModel.getFolderId());
117                    model.setName(soapModel.getName());
118                    model.setExtension(soapModel.getExtension());
119                    model.setTitle(soapModel.getTitle());
120                    model.setDescription(soapModel.getDescription());
121                    model.setExtraSettings(soapModel.getExtraSettings());
122                    model.setVersion(soapModel.getVersion());
123                    model.setSize(soapModel.getSize());
124                    model.setReadCount(soapModel.getReadCount());
125    
126                    return model;
127            }
128    
129            /**
130             * Converts the soap model instances into normal model instances.
131             *
132             * @param soapModels the soap model instances to convert
133             * @return the normal model instances
134             */
135            public static List<DLFileEntry> toModels(DLFileEntrySoap[] soapModels) {
136                    List<DLFileEntry> models = new ArrayList<DLFileEntry>(soapModels.length);
137    
138                    for (DLFileEntrySoap soapModel : soapModels) {
139                            models.add(toModel(soapModel));
140                    }
141    
142                    return models;
143            }
144    
145            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
146                                    "lock.expiration.time.com.liferay.portlet.documentlibrary.model.DLFileEntry"));
147    
148            public DLFileEntryModelImpl() {
149            }
150    
151            public long getPrimaryKey() {
152                    return _fileEntryId;
153            }
154    
155            public void setPrimaryKey(long pk) {
156                    setFileEntryId(pk);
157            }
158    
159            public Serializable getPrimaryKeyObj() {
160                    return new Long(_fileEntryId);
161            }
162    
163            public String getUuid() {
164                    if (_uuid == null) {
165                            return StringPool.BLANK;
166                    }
167                    else {
168                            return _uuid;
169                    }
170            }
171    
172            public void setUuid(String uuid) {
173                    _uuid = uuid;
174    
175                    if (_originalUuid == null) {
176                            _originalUuid = uuid;
177                    }
178            }
179    
180            public String getOriginalUuid() {
181                    return GetterUtil.getString(_originalUuid);
182            }
183    
184            public long getFileEntryId() {
185                    return _fileEntryId;
186            }
187    
188            public void setFileEntryId(long fileEntryId) {
189                    _fileEntryId = fileEntryId;
190            }
191    
192            public long getGroupId() {
193                    return _groupId;
194            }
195    
196            public void setGroupId(long groupId) {
197                    _groupId = groupId;
198    
199                    if (!_setOriginalGroupId) {
200                            _setOriginalGroupId = true;
201    
202                            _originalGroupId = groupId;
203                    }
204            }
205    
206            public long getOriginalGroupId() {
207                    return _originalGroupId;
208            }
209    
210            public long getCompanyId() {
211                    return _companyId;
212            }
213    
214            public void setCompanyId(long companyId) {
215                    _companyId = companyId;
216            }
217    
218            public long getUserId() {
219                    return _userId;
220            }
221    
222            public void setUserId(long userId) {
223                    _userId = userId;
224            }
225    
226            public String getUserUuid() throws SystemException {
227                    return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
228            }
229    
230            public void setUserUuid(String userUuid) {
231                    _userUuid = userUuid;
232            }
233    
234            public String getUserName() {
235                    if (_userName == null) {
236                            return StringPool.BLANK;
237                    }
238                    else {
239                            return _userName;
240                    }
241            }
242    
243            public void setUserName(String userName) {
244                    _userName = userName;
245            }
246    
247            public long getVersionUserId() {
248                    return _versionUserId;
249            }
250    
251            public void setVersionUserId(long versionUserId) {
252                    _versionUserId = versionUserId;
253            }
254    
255            public String getVersionUserUuid() throws SystemException {
256                    return PortalUtil.getUserValue(getVersionUserId(), "uuid",
257                            _versionUserUuid);
258            }
259    
260            public void setVersionUserUuid(String versionUserUuid) {
261                    _versionUserUuid = versionUserUuid;
262            }
263    
264            public String getVersionUserName() {
265                    if (_versionUserName == null) {
266                            return StringPool.BLANK;
267                    }
268                    else {
269                            return _versionUserName;
270                    }
271            }
272    
273            public void setVersionUserName(String versionUserName) {
274                    _versionUserName = versionUserName;
275            }
276    
277            public Date getCreateDate() {
278                    return _createDate;
279            }
280    
281            public void setCreateDate(Date createDate) {
282                    _createDate = createDate;
283            }
284    
285            public Date getModifiedDate() {
286                    return _modifiedDate;
287            }
288    
289            public void setModifiedDate(Date modifiedDate) {
290                    _modifiedDate = modifiedDate;
291            }
292    
293            public long getFolderId() {
294                    return _folderId;
295            }
296    
297            public void setFolderId(long folderId) {
298                    _folderId = folderId;
299    
300                    if (!_setOriginalFolderId) {
301                            _setOriginalFolderId = true;
302    
303                            _originalFolderId = folderId;
304                    }
305            }
306    
307            public long getOriginalFolderId() {
308                    return _originalFolderId;
309            }
310    
311            public String getName() {
312                    if (_name == null) {
313                            return StringPool.BLANK;
314                    }
315                    else {
316                            return _name;
317                    }
318            }
319    
320            public void setName(String name) {
321                    _name = name;
322    
323                    if (_originalName == null) {
324                            _originalName = name;
325                    }
326            }
327    
328            public String getOriginalName() {
329                    return GetterUtil.getString(_originalName);
330            }
331    
332            public String getExtension() {
333                    if (_extension == null) {
334                            return StringPool.BLANK;
335                    }
336                    else {
337                            return _extension;
338                    }
339            }
340    
341            public void setExtension(String extension) {
342                    _extension = extension;
343            }
344    
345            public String getTitle() {
346                    if (_title == null) {
347                            return StringPool.BLANK;
348                    }
349                    else {
350                            return _title;
351                    }
352            }
353    
354            public void setTitle(String title) {
355                    _title = title;
356    
357                    if (_originalTitle == null) {
358                            _originalTitle = title;
359                    }
360            }
361    
362            public String getOriginalTitle() {
363                    return GetterUtil.getString(_originalTitle);
364            }
365    
366            public String getDescription() {
367                    if (_description == null) {
368                            return StringPool.BLANK;
369                    }
370                    else {
371                            return _description;
372                    }
373            }
374    
375            public void setDescription(String description) {
376                    _description = description;
377            }
378    
379            public String getExtraSettings() {
380                    if (_extraSettings == null) {
381                            return StringPool.BLANK;
382                    }
383                    else {
384                            return _extraSettings;
385                    }
386            }
387    
388            public void setExtraSettings(String extraSettings) {
389                    _extraSettings = extraSettings;
390            }
391    
392            public String getVersion() {
393                    if (_version == null) {
394                            return StringPool.BLANK;
395                    }
396                    else {
397                            return _version;
398                    }
399            }
400    
401            public void setVersion(String version) {
402                    _version = version;
403            }
404    
405            public long getSize() {
406                    return _size;
407            }
408    
409            public void setSize(long size) {
410                    _size = size;
411            }
412    
413            public int getReadCount() {
414                    return _readCount;
415            }
416    
417            public void setReadCount(int readCount) {
418                    _readCount = readCount;
419            }
420    
421            public DLFileEntry toEscapedModel() {
422                    if (isEscapedModel()) {
423                            return (DLFileEntry)this;
424                    }
425                    else {
426                            return (DLFileEntry)Proxy.newProxyInstance(DLFileEntry.class.getClassLoader(),
427                                    new Class[] { DLFileEntry.class },
428                                    new AutoEscapeBeanHandler(this));
429                    }
430            }
431    
432            public ExpandoBridge getExpandoBridge() {
433                    if (_expandoBridge == null) {
434                            _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
435                                            DLFileEntry.class.getName(), getPrimaryKey());
436                    }
437    
438                    return _expandoBridge;
439            }
440    
441            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
442                    getExpandoBridge().setAttributes(serviceContext);
443            }
444    
445            public Object clone() {
446                    DLFileEntryImpl clone = new DLFileEntryImpl();
447    
448                    clone.setUuid(getUuid());
449                    clone.setFileEntryId(getFileEntryId());
450                    clone.setGroupId(getGroupId());
451                    clone.setCompanyId(getCompanyId());
452                    clone.setUserId(getUserId());
453                    clone.setUserName(getUserName());
454                    clone.setVersionUserId(getVersionUserId());
455                    clone.setVersionUserName(getVersionUserName());
456                    clone.setCreateDate(getCreateDate());
457                    clone.setModifiedDate(getModifiedDate());
458                    clone.setFolderId(getFolderId());
459                    clone.setName(getName());
460                    clone.setExtension(getExtension());
461                    clone.setTitle(getTitle());
462                    clone.setDescription(getDescription());
463                    clone.setExtraSettings(getExtraSettings());
464                    clone.setVersion(getVersion());
465                    clone.setSize(getSize());
466                    clone.setReadCount(getReadCount());
467    
468                    return clone;
469            }
470    
471            public int compareTo(DLFileEntry dlFileEntry) {
472                    int value = 0;
473    
474                    if (getFolderId() < dlFileEntry.getFolderId()) {
475                            value = -1;
476                    }
477                    else if (getFolderId() > dlFileEntry.getFolderId()) {
478                            value = 1;
479                    }
480                    else {
481                            value = 0;
482                    }
483    
484                    if (value != 0) {
485                            return value;
486                    }
487    
488                    value = getName().compareTo(dlFileEntry.getName());
489    
490                    if (value != 0) {
491                            return value;
492                    }
493    
494                    return 0;
495            }
496    
497            public boolean equals(Object obj) {
498                    if (obj == null) {
499                            return false;
500                    }
501    
502                    DLFileEntry dlFileEntry = null;
503    
504                    try {
505                            dlFileEntry = (DLFileEntry)obj;
506                    }
507                    catch (ClassCastException cce) {
508                            return false;
509                    }
510    
511                    long pk = dlFileEntry.getPrimaryKey();
512    
513                    if (getPrimaryKey() == pk) {
514                            return true;
515                    }
516                    else {
517                            return false;
518                    }
519            }
520    
521            public int hashCode() {
522                    return (int)getPrimaryKey();
523            }
524    
525            public String toString() {
526                    StringBundler sb = new StringBundler(39);
527    
528                    sb.append("{uuid=");
529                    sb.append(getUuid());
530                    sb.append(", fileEntryId=");
531                    sb.append(getFileEntryId());
532                    sb.append(", groupId=");
533                    sb.append(getGroupId());
534                    sb.append(", companyId=");
535                    sb.append(getCompanyId());
536                    sb.append(", userId=");
537                    sb.append(getUserId());
538                    sb.append(", userName=");
539                    sb.append(getUserName());
540                    sb.append(", versionUserId=");
541                    sb.append(getVersionUserId());
542                    sb.append(", versionUserName=");
543                    sb.append(getVersionUserName());
544                    sb.append(", createDate=");
545                    sb.append(getCreateDate());
546                    sb.append(", modifiedDate=");
547                    sb.append(getModifiedDate());
548                    sb.append(", folderId=");
549                    sb.append(getFolderId());
550                    sb.append(", name=");
551                    sb.append(getName());
552                    sb.append(", extension=");
553                    sb.append(getExtension());
554                    sb.append(", title=");
555                    sb.append(getTitle());
556                    sb.append(", description=");
557                    sb.append(getDescription());
558                    sb.append(", extraSettings=");
559                    sb.append(getExtraSettings());
560                    sb.append(", version=");
561                    sb.append(getVersion());
562                    sb.append(", size=");
563                    sb.append(getSize());
564                    sb.append(", readCount=");
565                    sb.append(getReadCount());
566                    sb.append("}");
567    
568                    return sb.toString();
569            }
570    
571            public String toXmlString() {
572                    StringBundler sb = new StringBundler(61);
573    
574                    sb.append("<model><model-name>");
575                    sb.append("com.liferay.portlet.documentlibrary.model.DLFileEntry");
576                    sb.append("</model-name>");
577    
578                    sb.append(
579                            "<column><column-name>uuid</column-name><column-value><![CDATA[");
580                    sb.append(getUuid());
581                    sb.append("]]></column-value></column>");
582                    sb.append(
583                            "<column><column-name>fileEntryId</column-name><column-value><![CDATA[");
584                    sb.append(getFileEntryId());
585                    sb.append("]]></column-value></column>");
586                    sb.append(
587                            "<column><column-name>groupId</column-name><column-value><![CDATA[");
588                    sb.append(getGroupId());
589                    sb.append("]]></column-value></column>");
590                    sb.append(
591                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
592                    sb.append(getCompanyId());
593                    sb.append("]]></column-value></column>");
594                    sb.append(
595                            "<column><column-name>userId</column-name><column-value><![CDATA[");
596                    sb.append(getUserId());
597                    sb.append("]]></column-value></column>");
598                    sb.append(
599                            "<column><column-name>userName</column-name><column-value><![CDATA[");
600                    sb.append(getUserName());
601                    sb.append("]]></column-value></column>");
602                    sb.append(
603                            "<column><column-name>versionUserId</column-name><column-value><![CDATA[");
604                    sb.append(getVersionUserId());
605                    sb.append("]]></column-value></column>");
606                    sb.append(
607                            "<column><column-name>versionUserName</column-name><column-value><![CDATA[");
608                    sb.append(getVersionUserName());
609                    sb.append("]]></column-value></column>");
610                    sb.append(
611                            "<column><column-name>createDate</column-name><column-value><![CDATA[");
612                    sb.append(getCreateDate());
613                    sb.append("]]></column-value></column>");
614                    sb.append(
615                            "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
616                    sb.append(getModifiedDate());
617                    sb.append("]]></column-value></column>");
618                    sb.append(
619                            "<column><column-name>folderId</column-name><column-value><![CDATA[");
620                    sb.append(getFolderId());
621                    sb.append("]]></column-value></column>");
622                    sb.append(
623                            "<column><column-name>name</column-name><column-value><![CDATA[");
624                    sb.append(getName());
625                    sb.append("]]></column-value></column>");
626                    sb.append(
627                            "<column><column-name>extension</column-name><column-value><![CDATA[");
628                    sb.append(getExtension());
629                    sb.append("]]></column-value></column>");
630                    sb.append(
631                            "<column><column-name>title</column-name><column-value><![CDATA[");
632                    sb.append(getTitle());
633                    sb.append("]]></column-value></column>");
634                    sb.append(
635                            "<column><column-name>description</column-name><column-value><![CDATA[");
636                    sb.append(getDescription());
637                    sb.append("]]></column-value></column>");
638                    sb.append(
639                            "<column><column-name>extraSettings</column-name><column-value><![CDATA[");
640                    sb.append(getExtraSettings());
641                    sb.append("]]></column-value></column>");
642                    sb.append(
643                            "<column><column-name>version</column-name><column-value><![CDATA[");
644                    sb.append(getVersion());
645                    sb.append("]]></column-value></column>");
646                    sb.append(
647                            "<column><column-name>size</column-name><column-value><![CDATA[");
648                    sb.append(getSize());
649                    sb.append("]]></column-value></column>");
650                    sb.append(
651                            "<column><column-name>readCount</column-name><column-value><![CDATA[");
652                    sb.append(getReadCount());
653                    sb.append("]]></column-value></column>");
654    
655                    sb.append("</model>");
656    
657                    return sb.toString();
658            }
659    
660            private String _uuid;
661            private String _originalUuid;
662            private long _fileEntryId;
663            private long _groupId;
664            private long _originalGroupId;
665            private boolean _setOriginalGroupId;
666            private long _companyId;
667            private long _userId;
668            private String _userUuid;
669            private String _userName;
670            private long _versionUserId;
671            private String _versionUserUuid;
672            private String _versionUserName;
673            private Date _createDate;
674            private Date _modifiedDate;
675            private long _folderId;
676            private long _originalFolderId;
677            private boolean _setOriginalFolderId;
678            private String _name;
679            private String _originalName;
680            private String _extension;
681            private String _title;
682            private String _originalTitle;
683            private String _description;
684            private String _extraSettings;
685            private String _version;
686            private long _size;
687            private int _readCount;
688            private transient ExpandoBridge _expandoBridge;
689    }