1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portlet.documentlibrary.model.impl;
16  
17  import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
18  import com.liferay.portal.kernel.exception.SystemException;
19  import com.liferay.portal.kernel.util.GetterUtil;
20  import com.liferay.portal.kernel.util.StringBundler;
21  import com.liferay.portal.kernel.util.StringPool;
22  import com.liferay.portal.model.impl.BaseModelImpl;
23  import com.liferay.portal.service.ServiceContext;
24  import com.liferay.portal.util.PortalUtil;
25  
26  import com.liferay.portlet.documentlibrary.model.DLFileEntry;
27  import com.liferay.portlet.documentlibrary.model.DLFileEntrySoap;
28  import com.liferay.portlet.expando.model.ExpandoBridge;
29  import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
30  
31  import java.io.Serializable;
32  
33  import java.lang.reflect.Proxy;
34  
35  import java.sql.Types;
36  
37  import java.util.ArrayList;
38  import java.util.Date;
39  import java.util.List;
40  
41  /**
42   * <a href="DLFileEntryModelImpl.java.html"><b><i>View Source</i></b></a>
43   *
44   * <p>
45   * ServiceBuilder generated this class. Modifications in this class will be
46   * overwritten the next time is generated.
47   * </p>
48   *
49   * <p>
50   * This interface is a model that represents the DLFileEntry table in the
51   * database.
52   * </p>
53   *
54   * @author    Brian Wing Shun Chan
55   * @see       DLFileEntryImpl
56   * @see       com.liferay.portlet.documentlibrary.model.DLFileEntry
57   * @see       com.liferay.portlet.documentlibrary.model.DLFileEntryModel
58   * @generated
59   */
60  public class DLFileEntryModelImpl extends BaseModelImpl<DLFileEntry> {
61      public static final String TABLE_NAME = "DLFileEntry";
62      public static final Object[][] TABLE_COLUMNS = {
63              { "uuid_", new Integer(Types.VARCHAR) },
64              { "fileEntryId", new Integer(Types.BIGINT) },
65              { "groupId", new Integer(Types.BIGINT) },
66              { "companyId", new Integer(Types.BIGINT) },
67              { "userId", new Integer(Types.BIGINT) },
68              { "userName", new Integer(Types.VARCHAR) },
69              { "versionUserId", new Integer(Types.BIGINT) },
70              { "versionUserName", new Integer(Types.VARCHAR) },
71              { "createDate", new Integer(Types.TIMESTAMP) },
72              { "modifiedDate", new Integer(Types.TIMESTAMP) },
73              { "folderId", new Integer(Types.BIGINT) },
74              { "name", new Integer(Types.VARCHAR) },
75              { "title", new Integer(Types.VARCHAR) },
76              { "description", new Integer(Types.VARCHAR) },
77              { "version", new Integer(Types.VARCHAR) },
78              { "size_", new Integer(Types.BIGINT) },
79              { "readCount", new Integer(Types.INTEGER) },
80              { "extraSettings", new Integer(Types.CLOB) }
81          };
82      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,title VARCHAR(255) null,description STRING null,version VARCHAR(75) null,size_ LONG,readCount INTEGER,extraSettings TEXT null)";
83      public static final String TABLE_SQL_DROP = "drop table DLFileEntry";
84      public static final String ORDER_BY_JPQL = " ORDER BY dlFileEntry.folderId ASC, dlFileEntry.name ASC";
85      public static final String ORDER_BY_SQL = " ORDER BY DLFileEntry.folderId ASC, DLFileEntry.name ASC";
86      public static final String DATA_SOURCE = "liferayDataSource";
87      public static final String SESSION_FACTORY = "liferaySessionFactory";
88      public static final String TX_MANAGER = "liferayTransactionManager";
89      public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
90                  "value.object.entity.cache.enabled.com.liferay.portlet.documentlibrary.model.DLFileEntry"),
91              true);
92      public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
93                  "value.object.finder.cache.enabled.com.liferay.portlet.documentlibrary.model.DLFileEntry"),
94              true);
95  
96      public static DLFileEntry toModel(DLFileEntrySoap soapModel) {
97          DLFileEntry model = new DLFileEntryImpl();
98  
99          model.setUuid(soapModel.getUuid());
100         model.setFileEntryId(soapModel.getFileEntryId());
101         model.setGroupId(soapModel.getGroupId());
102         model.setCompanyId(soapModel.getCompanyId());
103         model.setUserId(soapModel.getUserId());
104         model.setUserName(soapModel.getUserName());
105         model.setVersionUserId(soapModel.getVersionUserId());
106         model.setVersionUserName(soapModel.getVersionUserName());
107         model.setCreateDate(soapModel.getCreateDate());
108         model.setModifiedDate(soapModel.getModifiedDate());
109         model.setFolderId(soapModel.getFolderId());
110         model.setName(soapModel.getName());
111         model.setTitle(soapModel.getTitle());
112         model.setDescription(soapModel.getDescription());
113         model.setVersion(soapModel.getVersion());
114         model.setSize(soapModel.getSize());
115         model.setReadCount(soapModel.getReadCount());
116         model.setExtraSettings(soapModel.getExtraSettings());
117 
118         return model;
119     }
120 
121     public static List<DLFileEntry> toModels(DLFileEntrySoap[] soapModels) {
122         List<DLFileEntry> models = new ArrayList<DLFileEntry>(soapModels.length);
123 
124         for (DLFileEntrySoap soapModel : soapModels) {
125             models.add(toModel(soapModel));
126         }
127 
128         return models;
129     }
130 
131     public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
132                 "lock.expiration.time.com.liferay.portlet.documentlibrary.model.DLFileEntry"));
133 
134     public DLFileEntryModelImpl() {
135     }
136 
137     public long getPrimaryKey() {
138         return _fileEntryId;
139     }
140 
141     public void setPrimaryKey(long pk) {
142         setFileEntryId(pk);
143     }
144 
145     public Serializable getPrimaryKeyObj() {
146         return new Long(_fileEntryId);
147     }
148 
149     public String getUuid() {
150         if (_uuid == null) {
151             return StringPool.BLANK;
152         }
153         else {
154             return _uuid;
155         }
156     }
157 
158     public void setUuid(String uuid) {
159         _uuid = uuid;
160 
161         if (_originalUuid == null) {
162             _originalUuid = uuid;
163         }
164     }
165 
166     public String getOriginalUuid() {
167         return GetterUtil.getString(_originalUuid);
168     }
169 
170     public long getFileEntryId() {
171         return _fileEntryId;
172     }
173 
174     public void setFileEntryId(long fileEntryId) {
175         _fileEntryId = fileEntryId;
176     }
177 
178     public long getGroupId() {
179         return _groupId;
180     }
181 
182     public void setGroupId(long groupId) {
183         _groupId = groupId;
184 
185         if (!_setOriginalGroupId) {
186             _setOriginalGroupId = true;
187 
188             _originalGroupId = groupId;
189         }
190     }
191 
192     public long getOriginalGroupId() {
193         return _originalGroupId;
194     }
195 
196     public long getCompanyId() {
197         return _companyId;
198     }
199 
200     public void setCompanyId(long companyId) {
201         _companyId = companyId;
202     }
203 
204     public long getUserId() {
205         return _userId;
206     }
207 
208     public void setUserId(long userId) {
209         _userId = userId;
210     }
211 
212     public String getUserUuid() throws SystemException {
213         return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
214     }
215 
216     public void setUserUuid(String userUuid) {
217         _userUuid = userUuid;
218     }
219 
220     public String getUserName() {
221         if (_userName == null) {
222             return StringPool.BLANK;
223         }
224         else {
225             return _userName;
226         }
227     }
228 
229     public void setUserName(String userName) {
230         _userName = userName;
231     }
232 
233     public long getVersionUserId() {
234         return _versionUserId;
235     }
236 
237     public void setVersionUserId(long versionUserId) {
238         _versionUserId = versionUserId;
239     }
240 
241     public String getVersionUserUuid() throws SystemException {
242         return PortalUtil.getUserValue(getVersionUserId(), "uuid",
243             _versionUserUuid);
244     }
245 
246     public void setVersionUserUuid(String versionUserUuid) {
247         _versionUserUuid = versionUserUuid;
248     }
249 
250     public String getVersionUserName() {
251         if (_versionUserName == null) {
252             return StringPool.BLANK;
253         }
254         else {
255             return _versionUserName;
256         }
257     }
258 
259     public void setVersionUserName(String versionUserName) {
260         _versionUserName = versionUserName;
261     }
262 
263     public Date getCreateDate() {
264         return _createDate;
265     }
266 
267     public void setCreateDate(Date createDate) {
268         _createDate = createDate;
269     }
270 
271     public Date getModifiedDate() {
272         return _modifiedDate;
273     }
274 
275     public void setModifiedDate(Date modifiedDate) {
276         _modifiedDate = modifiedDate;
277     }
278 
279     public long getFolderId() {
280         return _folderId;
281     }
282 
283     public void setFolderId(long folderId) {
284         _folderId = folderId;
285 
286         if (!_setOriginalFolderId) {
287             _setOriginalFolderId = true;
288 
289             _originalFolderId = folderId;
290         }
291     }
292 
293     public long getOriginalFolderId() {
294         return _originalFolderId;
295     }
296 
297     public String getName() {
298         if (_name == null) {
299             return StringPool.BLANK;
300         }
301         else {
302             return _name;
303         }
304     }
305 
306     public void setName(String name) {
307         _name = name;
308 
309         if (_originalName == null) {
310             _originalName = name;
311         }
312     }
313 
314     public String getOriginalName() {
315         return GetterUtil.getString(_originalName);
316     }
317 
318     public String getTitle() {
319         if (_title == null) {
320             return StringPool.BLANK;
321         }
322         else {
323             return _title;
324         }
325     }
326 
327     public void setTitle(String title) {
328         _title = title;
329 
330         if (_originalTitle == null) {
331             _originalTitle = title;
332         }
333     }
334 
335     public String getOriginalTitle() {
336         return GetterUtil.getString(_originalTitle);
337     }
338 
339     public String getDescription() {
340         if (_description == null) {
341             return StringPool.BLANK;
342         }
343         else {
344             return _description;
345         }
346     }
347 
348     public void setDescription(String description) {
349         _description = description;
350     }
351 
352     public String getVersion() {
353         if (_version == null) {
354             return StringPool.BLANK;
355         }
356         else {
357             return _version;
358         }
359     }
360 
361     public void setVersion(String version) {
362         _version = version;
363     }
364 
365     public long getSize() {
366         return _size;
367     }
368 
369     public void setSize(long size) {
370         _size = size;
371     }
372 
373     public int getReadCount() {
374         return _readCount;
375     }
376 
377     public void setReadCount(int readCount) {
378         _readCount = readCount;
379     }
380 
381     public String getExtraSettings() {
382         if (_extraSettings == null) {
383             return StringPool.BLANK;
384         }
385         else {
386             return _extraSettings;
387         }
388     }
389 
390     public void setExtraSettings(String extraSettings) {
391         _extraSettings = extraSettings;
392     }
393 
394     public DLFileEntry toEscapedModel() {
395         if (isEscapedModel()) {
396             return (DLFileEntry)this;
397         }
398         else {
399             return (DLFileEntry)Proxy.newProxyInstance(DLFileEntry.class.getClassLoader(),
400                 new Class[] { DLFileEntry.class },
401                 new AutoEscapeBeanHandler(this));
402         }
403     }
404 
405     public ExpandoBridge getExpandoBridge() {
406         if (_expandoBridge == null) {
407             _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
408                     DLFileEntry.class.getName(), getPrimaryKey());
409         }
410 
411         return _expandoBridge;
412     }
413 
414     public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
415         getExpandoBridge().setAttributes(serviceContext);
416     }
417 
418     public Object clone() {
419         DLFileEntryImpl clone = new DLFileEntryImpl();
420 
421         clone.setUuid(getUuid());
422         clone.setFileEntryId(getFileEntryId());
423         clone.setGroupId(getGroupId());
424         clone.setCompanyId(getCompanyId());
425         clone.setUserId(getUserId());
426         clone.setUserName(getUserName());
427         clone.setVersionUserId(getVersionUserId());
428         clone.setVersionUserName(getVersionUserName());
429         clone.setCreateDate(getCreateDate());
430         clone.setModifiedDate(getModifiedDate());
431         clone.setFolderId(getFolderId());
432         clone.setName(getName());
433         clone.setTitle(getTitle());
434         clone.setDescription(getDescription());
435         clone.setVersion(getVersion());
436         clone.setSize(getSize());
437         clone.setReadCount(getReadCount());
438         clone.setExtraSettings(getExtraSettings());
439 
440         return clone;
441     }
442 
443     public int compareTo(DLFileEntry dlFileEntry) {
444         int value = 0;
445 
446         if (getFolderId() < dlFileEntry.getFolderId()) {
447             value = -1;
448         }
449         else if (getFolderId() > dlFileEntry.getFolderId()) {
450             value = 1;
451         }
452         else {
453             value = 0;
454         }
455 
456         if (value != 0) {
457             return value;
458         }
459 
460         value = getName().compareTo(dlFileEntry.getName());
461 
462         if (value != 0) {
463             return value;
464         }
465 
466         return 0;
467     }
468 
469     public boolean equals(Object obj) {
470         if (obj == null) {
471             return false;
472         }
473 
474         DLFileEntry dlFileEntry = null;
475 
476         try {
477             dlFileEntry = (DLFileEntry)obj;
478         }
479         catch (ClassCastException cce) {
480             return false;
481         }
482 
483         long pk = dlFileEntry.getPrimaryKey();
484 
485         if (getPrimaryKey() == pk) {
486             return true;
487         }
488         else {
489             return false;
490         }
491     }
492 
493     public int hashCode() {
494         return (int)getPrimaryKey();
495     }
496 
497     public String toString() {
498         StringBundler sb = new StringBundler(37);
499 
500         sb.append("{uuid=");
501         sb.append(getUuid());
502         sb.append(", fileEntryId=");
503         sb.append(getFileEntryId());
504         sb.append(", groupId=");
505         sb.append(getGroupId());
506         sb.append(", companyId=");
507         sb.append(getCompanyId());
508         sb.append(", userId=");
509         sb.append(getUserId());
510         sb.append(", userName=");
511         sb.append(getUserName());
512         sb.append(", versionUserId=");
513         sb.append(getVersionUserId());
514         sb.append(", versionUserName=");
515         sb.append(getVersionUserName());
516         sb.append(", createDate=");
517         sb.append(getCreateDate());
518         sb.append(", modifiedDate=");
519         sb.append(getModifiedDate());
520         sb.append(", folderId=");
521         sb.append(getFolderId());
522         sb.append(", name=");
523         sb.append(getName());
524         sb.append(", title=");
525         sb.append(getTitle());
526         sb.append(", description=");
527         sb.append(getDescription());
528         sb.append(", version=");
529         sb.append(getVersion());
530         sb.append(", size=");
531         sb.append(getSize());
532         sb.append(", readCount=");
533         sb.append(getReadCount());
534         sb.append(", extraSettings=");
535         sb.append(getExtraSettings());
536         sb.append("}");
537 
538         return sb.toString();
539     }
540 
541     public String toXmlString() {
542         StringBundler sb = new StringBundler(58);
543 
544         sb.append("<model><model-name>");
545         sb.append("com.liferay.portlet.documentlibrary.model.DLFileEntry");
546         sb.append("</model-name>");
547 
548         sb.append(
549             "<column><column-name>uuid</column-name><column-value><![CDATA[");
550         sb.append(getUuid());
551         sb.append("]]></column-value></column>");
552         sb.append(
553             "<column><column-name>fileEntryId</column-name><column-value><![CDATA[");
554         sb.append(getFileEntryId());
555         sb.append("]]></column-value></column>");
556         sb.append(
557             "<column><column-name>groupId</column-name><column-value><![CDATA[");
558         sb.append(getGroupId());
559         sb.append("]]></column-value></column>");
560         sb.append(
561             "<column><column-name>companyId</column-name><column-value><![CDATA[");
562         sb.append(getCompanyId());
563         sb.append("]]></column-value></column>");
564         sb.append(
565             "<column><column-name>userId</column-name><column-value><![CDATA[");
566         sb.append(getUserId());
567         sb.append("]]></column-value></column>");
568         sb.append(
569             "<column><column-name>userName</column-name><column-value><![CDATA[");
570         sb.append(getUserName());
571         sb.append("]]></column-value></column>");
572         sb.append(
573             "<column><column-name>versionUserId</column-name><column-value><![CDATA[");
574         sb.append(getVersionUserId());
575         sb.append("]]></column-value></column>");
576         sb.append(
577             "<column><column-name>versionUserName</column-name><column-value><![CDATA[");
578         sb.append(getVersionUserName());
579         sb.append("]]></column-value></column>");
580         sb.append(
581             "<column><column-name>createDate</column-name><column-value><![CDATA[");
582         sb.append(getCreateDate());
583         sb.append("]]></column-value></column>");
584         sb.append(
585             "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
586         sb.append(getModifiedDate());
587         sb.append("]]></column-value></column>");
588         sb.append(
589             "<column><column-name>folderId</column-name><column-value><![CDATA[");
590         sb.append(getFolderId());
591         sb.append("]]></column-value></column>");
592         sb.append(
593             "<column><column-name>name</column-name><column-value><![CDATA[");
594         sb.append(getName());
595         sb.append("]]></column-value></column>");
596         sb.append(
597             "<column><column-name>title</column-name><column-value><![CDATA[");
598         sb.append(getTitle());
599         sb.append("]]></column-value></column>");
600         sb.append(
601             "<column><column-name>description</column-name><column-value><![CDATA[");
602         sb.append(getDescription());
603         sb.append("]]></column-value></column>");
604         sb.append(
605             "<column><column-name>version</column-name><column-value><![CDATA[");
606         sb.append(getVersion());
607         sb.append("]]></column-value></column>");
608         sb.append(
609             "<column><column-name>size</column-name><column-value><![CDATA[");
610         sb.append(getSize());
611         sb.append("]]></column-value></column>");
612         sb.append(
613             "<column><column-name>readCount</column-name><column-value><![CDATA[");
614         sb.append(getReadCount());
615         sb.append("]]></column-value></column>");
616         sb.append(
617             "<column><column-name>extraSettings</column-name><column-value><![CDATA[");
618         sb.append(getExtraSettings());
619         sb.append("]]></column-value></column>");
620 
621         sb.append("</model>");
622 
623         return sb.toString();
624     }
625 
626     private String _uuid;
627     private String _originalUuid;
628     private long _fileEntryId;
629     private long _groupId;
630     private long _originalGroupId;
631     private boolean _setOriginalGroupId;
632     private long _companyId;
633     private long _userId;
634     private String _userUuid;
635     private String _userName;
636     private long _versionUserId;
637     private String _versionUserUuid;
638     private String _versionUserName;
639     private Date _createDate;
640     private Date _modifiedDate;
641     private long _folderId;
642     private long _originalFolderId;
643     private boolean _setOriginalFolderId;
644     private String _name;
645     private String _originalName;
646     private String _title;
647     private String _originalTitle;
648     private String _description;
649     private String _version;
650     private long _size;
651     private int _readCount;
652     private String _extraSettings;
653     private transient ExpandoBridge _expandoBridge;
654 }