1
22
23 package com.liferay.portlet.documentlibrary.model.impl;
24
25 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
26 import com.liferay.portal.kernel.util.GetterUtil;
27 import com.liferay.portal.kernel.util.HtmlUtil;
28 import com.liferay.portal.model.impl.BaseModelImpl;
29
30 import com.liferay.portlet.documentlibrary.model.DLFileEntry;
31 import com.liferay.portlet.documentlibrary.model.DLFileEntrySoap;
32
33 import java.io.Serializable;
34
35 import java.lang.reflect.Proxy;
36
37 import java.sql.Types;
38
39 import java.util.ArrayList;
40 import java.util.Date;
41 import java.util.List;
42
43
63 public class DLFileEntryModelImpl extends BaseModelImpl {
64 public static final String TABLE_NAME = "DLFileEntry";
65 public static final Object[][] TABLE_COLUMNS = {
66 { "uuid_", new Integer(Types.VARCHAR) },
67
68
69 { "fileEntryId", new Integer(Types.BIGINT) },
70
71
72 { "companyId", new Integer(Types.BIGINT) },
73
74
75 { "userId", new Integer(Types.BIGINT) },
76
77
78 { "userName", new Integer(Types.VARCHAR) },
79
80
81 { "versionUserId", new Integer(Types.BIGINT) },
82
83
84 { "versionUserName", new Integer(Types.VARCHAR) },
85
86
87 { "createDate", new Integer(Types.TIMESTAMP) },
88
89
90 { "modifiedDate", new Integer(Types.TIMESTAMP) },
91
92
93 { "folderId", new Integer(Types.BIGINT) },
94
95
96 { "name", new Integer(Types.VARCHAR) },
97
98
99 { "title", new Integer(Types.VARCHAR) },
100
101
102 { "description", new Integer(Types.VARCHAR) },
103
104
105 { "version", new Integer(Types.DOUBLE) },
106
107
108 { "size_", new Integer(Types.INTEGER) },
109
110
111 { "readCount", new Integer(Types.INTEGER) },
112
113
114 { "extraSettings", new Integer(Types.CLOB) }
115 };
116 public static final String TABLE_SQL_CREATE = "create table DLFileEntry (uuid_ VARCHAR(75) null,fileEntryId LONG not null primary key,companyId LONG,userId LONG,userName VARCHAR(75) null,versionUserId LONG,versionUserName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,folderId LONG,name VARCHAR(300) null,title VARCHAR(300) null,description STRING null,version DOUBLE,size_ INTEGER,readCount INTEGER,extraSettings TEXT null)";
117 public static final String TABLE_SQL_DROP = "drop table DLFileEntry";
118 public static final String DATA_SOURCE = "liferayDataSource";
119 public static final String SESSION_FACTORY = "liferaySessionFactory";
120 public static final String TX_MANAGER = "liferayTransactionManager";
121 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
122 "value.object.finder.cache.enabled.com.liferay.portlet.documentlibrary.model.DLFileEntry"),
123 true);
124
125 public static DLFileEntry toModel(DLFileEntrySoap soapModel) {
126 DLFileEntry model = new DLFileEntryImpl();
127
128 model.setUuid(soapModel.getUuid());
129 model.setFileEntryId(soapModel.getFileEntryId());
130 model.setCompanyId(soapModel.getCompanyId());
131 model.setUserId(soapModel.getUserId());
132 model.setUserName(soapModel.getUserName());
133 model.setVersionUserId(soapModel.getVersionUserId());
134 model.setVersionUserName(soapModel.getVersionUserName());
135 model.setCreateDate(soapModel.getCreateDate());
136 model.setModifiedDate(soapModel.getModifiedDate());
137 model.setFolderId(soapModel.getFolderId());
138 model.setName(soapModel.getName());
139 model.setTitle(soapModel.getTitle());
140 model.setDescription(soapModel.getDescription());
141 model.setVersion(soapModel.getVersion());
142 model.setSize(soapModel.getSize());
143 model.setReadCount(soapModel.getReadCount());
144 model.setExtraSettings(soapModel.getExtraSettings());
145
146 return model;
147 }
148
149 public static List<DLFileEntry> toModels(DLFileEntrySoap[] soapModels) {
150 List<DLFileEntry> models = new ArrayList<DLFileEntry>(soapModels.length);
151
152 for (DLFileEntrySoap soapModel : soapModels) {
153 models.add(toModel(soapModel));
154 }
155
156 return models;
157 }
158
159 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
160 "lock.expiration.time.com.liferay.portlet.documentlibrary.model.DLFileEntry"));
161
162 public DLFileEntryModelImpl() {
163 }
164
165 public long getPrimaryKey() {
166 return _fileEntryId;
167 }
168
169 public void setPrimaryKey(long pk) {
170 setFileEntryId(pk);
171 }
172
173 public Serializable getPrimaryKeyObj() {
174 return new Long(_fileEntryId);
175 }
176
177 public String getUuid() {
178 return GetterUtil.getString(_uuid);
179 }
180
181 public void setUuid(String uuid) {
182 if ((uuid != null) && (uuid != _uuid)) {
183 _uuid = uuid;
184 }
185 }
186
187 public long getFileEntryId() {
188 return _fileEntryId;
189 }
190
191 public void setFileEntryId(long fileEntryId) {
192 if (fileEntryId != _fileEntryId) {
193 _fileEntryId = fileEntryId;
194 }
195 }
196
197 public long getCompanyId() {
198 return _companyId;
199 }
200
201 public void setCompanyId(long companyId) {
202 if (companyId != _companyId) {
203 _companyId = companyId;
204 }
205 }
206
207 public long getUserId() {
208 return _userId;
209 }
210
211 public void setUserId(long userId) {
212 if (userId != _userId) {
213 _userId = userId;
214 }
215 }
216
217 public String getUserName() {
218 return GetterUtil.getString(_userName);
219 }
220
221 public void setUserName(String userName) {
222 if (((userName == null) && (_userName != null)) ||
223 ((userName != null) && (_userName == null)) ||
224 ((userName != null) && (_userName != null) &&
225 !userName.equals(_userName))) {
226 _userName = userName;
227 }
228 }
229
230 public long getVersionUserId() {
231 return _versionUserId;
232 }
233
234 public void setVersionUserId(long versionUserId) {
235 if (versionUserId != _versionUserId) {
236 _versionUserId = versionUserId;
237 }
238 }
239
240 public String getVersionUserName() {
241 return GetterUtil.getString(_versionUserName);
242 }
243
244 public void setVersionUserName(String versionUserName) {
245 if (((versionUserName == null) && (_versionUserName != null)) ||
246 ((versionUserName != null) && (_versionUserName == null)) ||
247 ((versionUserName != null) && (_versionUserName != null) &&
248 !versionUserName.equals(_versionUserName))) {
249 _versionUserName = versionUserName;
250 }
251 }
252
253 public Date getCreateDate() {
254 return _createDate;
255 }
256
257 public void setCreateDate(Date createDate) {
258 if (((createDate == null) && (_createDate != null)) ||
259 ((createDate != null) && (_createDate == null)) ||
260 ((createDate != null) && (_createDate != null) &&
261 !createDate.equals(_createDate))) {
262 _createDate = createDate;
263 }
264 }
265
266 public Date getModifiedDate() {
267 return _modifiedDate;
268 }
269
270 public void setModifiedDate(Date modifiedDate) {
271 if (((modifiedDate == null) && (_modifiedDate != null)) ||
272 ((modifiedDate != null) && (_modifiedDate == null)) ||
273 ((modifiedDate != null) && (_modifiedDate != null) &&
274 !modifiedDate.equals(_modifiedDate))) {
275 _modifiedDate = modifiedDate;
276 }
277 }
278
279 public long getFolderId() {
280 return _folderId;
281 }
282
283 public void setFolderId(long folderId) {
284 if (folderId != _folderId) {
285 _folderId = folderId;
286 }
287 }
288
289 public String getName() {
290 return GetterUtil.getString(_name);
291 }
292
293 public void setName(String name) {
294 if (((name == null) && (_name != null)) ||
295 ((name != null) && (_name == null)) ||
296 ((name != null) && (_name != null) && !name.equals(_name))) {
297 _name = name;
298 }
299 }
300
301 public String getTitle() {
302 return GetterUtil.getString(_title);
303 }
304
305 public void setTitle(String title) {
306 if (((title == null) && (_title != null)) ||
307 ((title != null) && (_title == null)) ||
308 ((title != null) && (_title != null) && !title.equals(_title))) {
309 _title = title;
310 }
311 }
312
313 public String getDescription() {
314 return GetterUtil.getString(_description);
315 }
316
317 public void setDescription(String description) {
318 if (((description == null) && (_description != null)) ||
319 ((description != null) && (_description == null)) ||
320 ((description != null) && (_description != null) &&
321 !description.equals(_description))) {
322 _description = description;
323 }
324 }
325
326 public double getVersion() {
327 return _version;
328 }
329
330 public void setVersion(double version) {
331 if (version != _version) {
332 _version = version;
333 }
334 }
335
336 public int getSize() {
337 return _size;
338 }
339
340 public void setSize(int size) {
341 if (size != _size) {
342 _size = size;
343 }
344 }
345
346 public int getReadCount() {
347 return _readCount;
348 }
349
350 public void setReadCount(int readCount) {
351 if (readCount != _readCount) {
352 _readCount = readCount;
353 }
354 }
355
356 public String getExtraSettings() {
357 return GetterUtil.getString(_extraSettings);
358 }
359
360 public void setExtraSettings(String extraSettings) {
361 if (((extraSettings == null) && (_extraSettings != null)) ||
362 ((extraSettings != null) && (_extraSettings == null)) ||
363 ((extraSettings != null) && (_extraSettings != null) &&
364 !extraSettings.equals(_extraSettings))) {
365 _extraSettings = extraSettings;
366 }
367 }
368
369 public DLFileEntry toEscapedModel() {
370 if (isEscapedModel()) {
371 return (DLFileEntry)this;
372 }
373 else {
374 DLFileEntry model = new DLFileEntryImpl();
375
376 model.setEscapedModel(true);
377
378 model.setUuid(HtmlUtil.escape(getUuid()));
379 model.setFileEntryId(getFileEntryId());
380 model.setCompanyId(getCompanyId());
381 model.setUserId(getUserId());
382 model.setUserName(HtmlUtil.escape(getUserName()));
383 model.setVersionUserId(getVersionUserId());
384 model.setVersionUserName(HtmlUtil.escape(getVersionUserName()));
385 model.setCreateDate(getCreateDate());
386 model.setModifiedDate(getModifiedDate());
387 model.setFolderId(getFolderId());
388 model.setName(HtmlUtil.escape(getName()));
389 model.setTitle(HtmlUtil.escape(getTitle()));
390 model.setDescription(HtmlUtil.escape(getDescription()));
391 model.setVersion(getVersion());
392 model.setSize(getSize());
393 model.setReadCount(getReadCount());
394 model.setExtraSettings(HtmlUtil.escape(getExtraSettings()));
395
396 model = (DLFileEntry)Proxy.newProxyInstance(DLFileEntry.class.getClassLoader(),
397 new Class[] { DLFileEntry.class },
398 new ReadOnlyBeanHandler(model));
399
400 return model;
401 }
402 }
403
404 public Object clone() {
405 DLFileEntryImpl clone = new DLFileEntryImpl();
406
407 clone.setUuid(getUuid());
408 clone.setFileEntryId(getFileEntryId());
409 clone.setCompanyId(getCompanyId());
410 clone.setUserId(getUserId());
411 clone.setUserName(getUserName());
412 clone.setVersionUserId(getVersionUserId());
413 clone.setVersionUserName(getVersionUserName());
414 clone.setCreateDate(getCreateDate());
415 clone.setModifiedDate(getModifiedDate());
416 clone.setFolderId(getFolderId());
417 clone.setName(getName());
418 clone.setTitle(getTitle());
419 clone.setDescription(getDescription());
420 clone.setVersion(getVersion());
421 clone.setSize(getSize());
422 clone.setReadCount(getReadCount());
423 clone.setExtraSettings(getExtraSettings());
424
425 return clone;
426 }
427
428 public int compareTo(Object obj) {
429 if (obj == null) {
430 return -1;
431 }
432
433 DLFileEntryImpl dlFileEntry = (DLFileEntryImpl)obj;
434
435 int value = 0;
436
437 if (getFolderId() < dlFileEntry.getFolderId()) {
438 value = -1;
439 }
440 else if (getFolderId() > dlFileEntry.getFolderId()) {
441 value = 1;
442 }
443 else {
444 value = 0;
445 }
446
447 if (value != 0) {
448 return value;
449 }
450
451 value = getName().compareTo(dlFileEntry.getName());
452
453 if (value != 0) {
454 return value;
455 }
456
457 return 0;
458 }
459
460 public boolean equals(Object obj) {
461 if (obj == null) {
462 return false;
463 }
464
465 DLFileEntryImpl dlFileEntry = null;
466
467 try {
468 dlFileEntry = (DLFileEntryImpl)obj;
469 }
470 catch (ClassCastException cce) {
471 return false;
472 }
473
474 long pk = dlFileEntry.getPrimaryKey();
475
476 if (getPrimaryKey() == pk) {
477 return true;
478 }
479 else {
480 return false;
481 }
482 }
483
484 public int hashCode() {
485 return (int)getPrimaryKey();
486 }
487
488 private String _uuid;
489 private long _fileEntryId;
490 private long _companyId;
491 private long _userId;
492 private String _userName;
493 private long _versionUserId;
494 private String _versionUserName;
495 private Date _createDate;
496 private Date _modifiedDate;
497 private long _folderId;
498 private String _name;
499 private String _title;
500 private String _description;
501 private double _version;
502 private int _size;
503 private int _readCount;
504 private String _extraSettings;
505 }