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