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