1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portlet.documentlibrary.model.impl;
16  
17  import com.liferay.portal.SystemException;
18  import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
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.DOUBLE) },
78              { "size_", new Integer(Types.INTEGER) },
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 DOUBLE,size_ INTEGER,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 
331     public String getDescription() {
332         if (_description == null) {
333             return StringPool.BLANK;
334         }
335         else {
336             return _description;
337         }
338     }
339 
340     public void setDescription(String description) {
341         _description = description;
342     }
343 
344     public double getVersion() {
345         return _version;
346     }
347 
348     public void setVersion(double version) {
349         _version = version;
350     }
351 
352     public int getSize() {
353         return _size;
354     }
355 
356     public void setSize(int size) {
357         _size = size;
358     }
359 
360     public int getReadCount() {
361         return _readCount;
362     }
363 
364     public void setReadCount(int readCount) {
365         _readCount = readCount;
366     }
367 
368     public String getExtraSettings() {
369         if (_extraSettings == null) {
370             return StringPool.BLANK;
371         }
372         else {
373             return _extraSettings;
374         }
375     }
376 
377     public void setExtraSettings(String extraSettings) {
378         _extraSettings = extraSettings;
379     }
380 
381     public DLFileEntry toEscapedModel() {
382         if (isEscapedModel()) {
383             return (DLFileEntry)this;
384         }
385         else {
386             return (DLFileEntry)Proxy.newProxyInstance(DLFileEntry.class.getClassLoader(),
387                 new Class[] { DLFileEntry.class },
388                 new AutoEscapeBeanHandler(this));
389         }
390     }
391 
392     public ExpandoBridge getExpandoBridge() {
393         if (_expandoBridge == null) {
394             _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(DLFileEntry.class.getName(),
395                     getPrimaryKey());
396         }
397 
398         return _expandoBridge;
399     }
400 
401     public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
402         getExpandoBridge().setAttributes(serviceContext);
403     }
404 
405     public Object clone() {
406         DLFileEntryImpl clone = new DLFileEntryImpl();
407 
408         clone.setUuid(getUuid());
409         clone.setFileEntryId(getFileEntryId());
410         clone.setGroupId(getGroupId());
411         clone.setCompanyId(getCompanyId());
412         clone.setUserId(getUserId());
413         clone.setUserName(getUserName());
414         clone.setVersionUserId(getVersionUserId());
415         clone.setVersionUserName(getVersionUserName());
416         clone.setCreateDate(getCreateDate());
417         clone.setModifiedDate(getModifiedDate());
418         clone.setFolderId(getFolderId());
419         clone.setName(getName());
420         clone.setTitle(getTitle());
421         clone.setDescription(getDescription());
422         clone.setVersion(getVersion());
423         clone.setSize(getSize());
424         clone.setReadCount(getReadCount());
425         clone.setExtraSettings(getExtraSettings());
426 
427         return clone;
428     }
429 
430     public int compareTo(DLFileEntry dlFileEntry) {
431         int value = 0;
432 
433         if (getFolderId() < dlFileEntry.getFolderId()) {
434             value = -1;
435         }
436         else if (getFolderId() > dlFileEntry.getFolderId()) {
437             value = 1;
438         }
439         else {
440             value = 0;
441         }
442 
443         if (value != 0) {
444             return value;
445         }
446 
447         value = getName().compareTo(dlFileEntry.getName());
448 
449         if (value != 0) {
450             return value;
451         }
452 
453         return 0;
454     }
455 
456     public boolean equals(Object obj) {
457         if (obj == null) {
458             return false;
459         }
460 
461         DLFileEntry dlFileEntry = null;
462 
463         try {
464             dlFileEntry = (DLFileEntry)obj;
465         }
466         catch (ClassCastException cce) {
467             return false;
468         }
469 
470         long pk = dlFileEntry.getPrimaryKey();
471 
472         if (getPrimaryKey() == pk) {
473             return true;
474         }
475         else {
476             return false;
477         }
478     }
479 
480     public int hashCode() {
481         return (int)getPrimaryKey();
482     }
483 
484     public String toString() {
485         StringBundler sb = new StringBundler(37);
486 
487         sb.append("{uuid=");
488         sb.append(getUuid());
489         sb.append(", fileEntryId=");
490         sb.append(getFileEntryId());
491         sb.append(", groupId=");
492         sb.append(getGroupId());
493         sb.append(", companyId=");
494         sb.append(getCompanyId());
495         sb.append(", userId=");
496         sb.append(getUserId());
497         sb.append(", userName=");
498         sb.append(getUserName());
499         sb.append(", versionUserId=");
500         sb.append(getVersionUserId());
501         sb.append(", versionUserName=");
502         sb.append(getVersionUserName());
503         sb.append(", createDate=");
504         sb.append(getCreateDate());
505         sb.append(", modifiedDate=");
506         sb.append(getModifiedDate());
507         sb.append(", folderId=");
508         sb.append(getFolderId());
509         sb.append(", name=");
510         sb.append(getName());
511         sb.append(", title=");
512         sb.append(getTitle());
513         sb.append(", description=");
514         sb.append(getDescription());
515         sb.append(", version=");
516         sb.append(getVersion());
517         sb.append(", size=");
518         sb.append(getSize());
519         sb.append(", readCount=");
520         sb.append(getReadCount());
521         sb.append(", extraSettings=");
522         sb.append(getExtraSettings());
523         sb.append("}");
524 
525         return sb.toString();
526     }
527 
528     public String toXmlString() {
529         StringBundler sb = new StringBundler(58);
530 
531         sb.append("<model><model-name>");
532         sb.append("com.liferay.portlet.documentlibrary.model.DLFileEntry");
533         sb.append("</model-name>");
534 
535         sb.append(
536             "<column><column-name>uuid</column-name><column-value><![CDATA[");
537         sb.append(getUuid());
538         sb.append("]]></column-value></column>");
539         sb.append(
540             "<column><column-name>fileEntryId</column-name><column-value><![CDATA[");
541         sb.append(getFileEntryId());
542         sb.append("]]></column-value></column>");
543         sb.append(
544             "<column><column-name>groupId</column-name><column-value><![CDATA[");
545         sb.append(getGroupId());
546         sb.append("]]></column-value></column>");
547         sb.append(
548             "<column><column-name>companyId</column-name><column-value><![CDATA[");
549         sb.append(getCompanyId());
550         sb.append("]]></column-value></column>");
551         sb.append(
552             "<column><column-name>userId</column-name><column-value><![CDATA[");
553         sb.append(getUserId());
554         sb.append("]]></column-value></column>");
555         sb.append(
556             "<column><column-name>userName</column-name><column-value><![CDATA[");
557         sb.append(getUserName());
558         sb.append("]]></column-value></column>");
559         sb.append(
560             "<column><column-name>versionUserId</column-name><column-value><![CDATA[");
561         sb.append(getVersionUserId());
562         sb.append("]]></column-value></column>");
563         sb.append(
564             "<column><column-name>versionUserName</column-name><column-value><![CDATA[");
565         sb.append(getVersionUserName());
566         sb.append("]]></column-value></column>");
567         sb.append(
568             "<column><column-name>createDate</column-name><column-value><![CDATA[");
569         sb.append(getCreateDate());
570         sb.append("]]></column-value></column>");
571         sb.append(
572             "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
573         sb.append(getModifiedDate());
574         sb.append("]]></column-value></column>");
575         sb.append(
576             "<column><column-name>folderId</column-name><column-value><![CDATA[");
577         sb.append(getFolderId());
578         sb.append("]]></column-value></column>");
579         sb.append(
580             "<column><column-name>name</column-name><column-value><![CDATA[");
581         sb.append(getName());
582         sb.append("]]></column-value></column>");
583         sb.append(
584             "<column><column-name>title</column-name><column-value><![CDATA[");
585         sb.append(getTitle());
586         sb.append("]]></column-value></column>");
587         sb.append(
588             "<column><column-name>description</column-name><column-value><![CDATA[");
589         sb.append(getDescription());
590         sb.append("]]></column-value></column>");
591         sb.append(
592             "<column><column-name>version</column-name><column-value><![CDATA[");
593         sb.append(getVersion());
594         sb.append("]]></column-value></column>");
595         sb.append(
596             "<column><column-name>size</column-name><column-value><![CDATA[");
597         sb.append(getSize());
598         sb.append("]]></column-value></column>");
599         sb.append(
600             "<column><column-name>readCount</column-name><column-value><![CDATA[");
601         sb.append(getReadCount());
602         sb.append("]]></column-value></column>");
603         sb.append(
604             "<column><column-name>extraSettings</column-name><column-value><![CDATA[");
605         sb.append(getExtraSettings());
606         sb.append("]]></column-value></column>");
607 
608         sb.append("</model>");
609 
610         return sb.toString();
611     }
612 
613     private String _uuid;
614     private String _originalUuid;
615     private long _fileEntryId;
616     private long _groupId;
617     private long _originalGroupId;
618     private boolean _setOriginalGroupId;
619     private long _companyId;
620     private long _userId;
621     private String _userUuid;
622     private String _userName;
623     private long _versionUserId;
624     private String _versionUserUuid;
625     private String _versionUserName;
626     private Date _createDate;
627     private Date _modifiedDate;
628     private long _folderId;
629     private long _originalFolderId;
630     private boolean _setOriginalFolderId;
631     private String _name;
632     private String _originalName;
633     private String _title;
634     private String _description;
635     private double _version;
636     private int _size;
637     private int _readCount;
638     private String _extraSettings;
639     private transient ExpandoBridge _expandoBridge;
640 }