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