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