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