001
014
015 package com.liferay.portlet.documentlibrary.model.impl;
016
017 import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
018 import com.liferay.portal.kernel.exception.SystemException;
019 import com.liferay.portal.kernel.util.GetterUtil;
020 import com.liferay.portal.kernel.util.StringBundler;
021 import com.liferay.portal.kernel.util.StringPool;
022 import com.liferay.portal.kernel.workflow.WorkflowConstants;
023 import com.liferay.portal.model.impl.BaseModelImpl;
024 import com.liferay.portal.service.ServiceContext;
025 import com.liferay.portal.util.PortalUtil;
026
027 import com.liferay.portlet.documentlibrary.model.DLFileShortcut;
028 import com.liferay.portlet.documentlibrary.model.DLFileShortcutModel;
029 import com.liferay.portlet.documentlibrary.model.DLFileShortcutSoap;
030 import com.liferay.portlet.expando.model.ExpandoBridge;
031 import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
032
033 import java.io.Serializable;
034
035 import java.lang.reflect.Proxy;
036
037 import java.sql.Types;
038
039 import java.util.ArrayList;
040 import java.util.Date;
041 import java.util.List;
042
043
060 public class DLFileShortcutModelImpl extends BaseModelImpl<DLFileShortcut>
061 implements DLFileShortcutModel {
062 public static final String TABLE_NAME = "DLFileShortcut";
063 public static final Object[][] TABLE_COLUMNS = {
064 { "uuid_", new Integer(Types.VARCHAR) },
065 { "fileShortcutId", new Integer(Types.BIGINT) },
066 { "groupId", new Integer(Types.BIGINT) },
067 { "companyId", new Integer(Types.BIGINT) },
068 { "userId", new Integer(Types.BIGINT) },
069 { "userName", new Integer(Types.VARCHAR) },
070 { "createDate", new Integer(Types.TIMESTAMP) },
071 { "modifiedDate", new Integer(Types.TIMESTAMP) },
072 { "folderId", new Integer(Types.BIGINT) },
073 { "toFolderId", new Integer(Types.BIGINT) },
074 { "toName", new Integer(Types.VARCHAR) },
075 { "status", new Integer(Types.INTEGER) },
076 { "statusByUserId", new Integer(Types.BIGINT) },
077 { "statusByUserName", new Integer(Types.VARCHAR) },
078 { "statusDate", new Integer(Types.TIMESTAMP) }
079 };
080 public static final String TABLE_SQL_CREATE = "create table DLFileShortcut (uuid_ VARCHAR(75) null,fileShortcutId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,folderId LONG,toFolderId LONG,toName VARCHAR(255) null,status INTEGER,statusByUserId LONG,statusByUserName VARCHAR(75) null,statusDate DATE null)";
081 public static final String TABLE_SQL_DROP = "drop table DLFileShortcut";
082 public static final String DATA_SOURCE = "liferayDataSource";
083 public static final String SESSION_FACTORY = "liferaySessionFactory";
084 public static final String TX_MANAGER = "liferayTransactionManager";
085 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
086 "value.object.entity.cache.enabled.com.liferay.portlet.documentlibrary.model.DLFileShortcut"),
087 true);
088 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
089 "value.object.finder.cache.enabled.com.liferay.portlet.documentlibrary.model.DLFileShortcut"),
090 true);
091
092
098 public static DLFileShortcut toModel(DLFileShortcutSoap soapModel) {
099 DLFileShortcut model = new DLFileShortcutImpl();
100
101 model.setUuid(soapModel.getUuid());
102 model.setFileShortcutId(soapModel.getFileShortcutId());
103 model.setGroupId(soapModel.getGroupId());
104 model.setCompanyId(soapModel.getCompanyId());
105 model.setUserId(soapModel.getUserId());
106 model.setUserName(soapModel.getUserName());
107 model.setCreateDate(soapModel.getCreateDate());
108 model.setModifiedDate(soapModel.getModifiedDate());
109 model.setFolderId(soapModel.getFolderId());
110 model.setToFolderId(soapModel.getToFolderId());
111 model.setToName(soapModel.getToName());
112 model.setStatus(soapModel.getStatus());
113 model.setStatusByUserId(soapModel.getStatusByUserId());
114 model.setStatusByUserName(soapModel.getStatusByUserName());
115 model.setStatusDate(soapModel.getStatusDate());
116
117 return model;
118 }
119
120
126 public static List<DLFileShortcut> toModels(DLFileShortcutSoap[] soapModels) {
127 List<DLFileShortcut> models = new ArrayList<DLFileShortcut>(soapModels.length);
128
129 for (DLFileShortcutSoap 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.DLFileShortcut"));
138
139 public DLFileShortcutModelImpl() {
140 }
141
142 public long getPrimaryKey() {
143 return _fileShortcutId;
144 }
145
146 public void setPrimaryKey(long pk) {
147 setFileShortcutId(pk);
148 }
149
150 public Serializable getPrimaryKeyObj() {
151 return new Long(_fileShortcutId);
152 }
153
154 public String getUuid() {
155 if (_uuid == null) {
156 return StringPool.BLANK;
157 }
158 else {
159 return _uuid;
160 }
161 }
162
163 public void setUuid(String uuid) {
164 _uuid = uuid;
165
166 if (_originalUuid == null) {
167 _originalUuid = uuid;
168 }
169 }
170
171 public String getOriginalUuid() {
172 return GetterUtil.getString(_originalUuid);
173 }
174
175 public long getFileShortcutId() {
176 return _fileShortcutId;
177 }
178
179 public void setFileShortcutId(long fileShortcutId) {
180 _fileShortcutId = fileShortcutId;
181 }
182
183 public long getGroupId() {
184 return _groupId;
185 }
186
187 public void setGroupId(long groupId) {
188 _groupId = groupId;
189
190 if (!_setOriginalGroupId) {
191 _setOriginalGroupId = true;
192
193 _originalGroupId = groupId;
194 }
195 }
196
197 public long getOriginalGroupId() {
198 return _originalGroupId;
199 }
200
201 public long getCompanyId() {
202 return _companyId;
203 }
204
205 public void setCompanyId(long companyId) {
206 _companyId = companyId;
207 }
208
209 public long getUserId() {
210 return _userId;
211 }
212
213 public void setUserId(long userId) {
214 _userId = userId;
215 }
216
217 public String getUserUuid() throws SystemException {
218 return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
219 }
220
221 public void setUserUuid(String userUuid) {
222 _userUuid = userUuid;
223 }
224
225 public String getUserName() {
226 if (_userName == null) {
227 return StringPool.BLANK;
228 }
229 else {
230 return _userName;
231 }
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 getFolderId() {
255 return _folderId;
256 }
257
258 public void setFolderId(long folderId) {
259 _folderId = folderId;
260 }
261
262 public long getToFolderId() {
263 return _toFolderId;
264 }
265
266 public void setToFolderId(long toFolderId) {
267 _toFolderId = toFolderId;
268 }
269
270 public String getToName() {
271 if (_toName == null) {
272 return StringPool.BLANK;
273 }
274 else {
275 return _toName;
276 }
277 }
278
279 public void setToName(String toName) {
280 _toName = toName;
281 }
282
283 public int getStatus() {
284 return _status;
285 }
286
287 public void setStatus(int status) {
288 _status = status;
289 }
290
291 public long getStatusByUserId() {
292 return _statusByUserId;
293 }
294
295 public void setStatusByUserId(long statusByUserId) {
296 _statusByUserId = statusByUserId;
297 }
298
299 public String getStatusByUserUuid() throws SystemException {
300 return PortalUtil.getUserValue(getStatusByUserId(), "uuid",
301 _statusByUserUuid);
302 }
303
304 public void setStatusByUserUuid(String statusByUserUuid) {
305 _statusByUserUuid = statusByUserUuid;
306 }
307
308 public String getStatusByUserName() {
309 if (_statusByUserName == null) {
310 return StringPool.BLANK;
311 }
312 else {
313 return _statusByUserName;
314 }
315 }
316
317 public void setStatusByUserName(String statusByUserName) {
318 _statusByUserName = statusByUserName;
319 }
320
321 public Date getStatusDate() {
322 return _statusDate;
323 }
324
325 public void setStatusDate(Date statusDate) {
326 _statusDate = statusDate;
327 }
328
329 public boolean isApproved() {
330 if (getStatus() == WorkflowConstants.STATUS_APPROVED) {
331 return true;
332 }
333 else {
334 return false;
335 }
336 }
337
338 public boolean isDraft() {
339 if (getStatus() == WorkflowConstants.STATUS_DRAFT) {
340 return true;
341 }
342 else {
343 return false;
344 }
345 }
346
347 public boolean isExpired() {
348 if (getStatus() == WorkflowConstants.STATUS_EXPIRED) {
349 return true;
350 }
351 else {
352 return false;
353 }
354 }
355
356 public boolean isPending() {
357 if (getStatus() == WorkflowConstants.STATUS_PENDING) {
358 return true;
359 }
360 else {
361 return false;
362 }
363 }
364
365 public DLFileShortcut toEscapedModel() {
366 if (isEscapedModel()) {
367 return (DLFileShortcut)this;
368 }
369 else {
370 return (DLFileShortcut)Proxy.newProxyInstance(DLFileShortcut.class.getClassLoader(),
371 new Class[] { DLFileShortcut.class },
372 new AutoEscapeBeanHandler(this));
373 }
374 }
375
376 public ExpandoBridge getExpandoBridge() {
377 if (_expandoBridge == null) {
378 _expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
379 DLFileShortcut.class.getName(), getPrimaryKey());
380 }
381
382 return _expandoBridge;
383 }
384
385 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
386 getExpandoBridge().setAttributes(serviceContext);
387 }
388
389 public Object clone() {
390 DLFileShortcutImpl clone = new DLFileShortcutImpl();
391
392 clone.setUuid(getUuid());
393 clone.setFileShortcutId(getFileShortcutId());
394 clone.setGroupId(getGroupId());
395 clone.setCompanyId(getCompanyId());
396 clone.setUserId(getUserId());
397 clone.setUserName(getUserName());
398 clone.setCreateDate(getCreateDate());
399 clone.setModifiedDate(getModifiedDate());
400 clone.setFolderId(getFolderId());
401 clone.setToFolderId(getToFolderId());
402 clone.setToName(getToName());
403 clone.setStatus(getStatus());
404 clone.setStatusByUserId(getStatusByUserId());
405 clone.setStatusByUserName(getStatusByUserName());
406 clone.setStatusDate(getStatusDate());
407
408 return clone;
409 }
410
411 public int compareTo(DLFileShortcut dlFileShortcut) {
412 long pk = dlFileShortcut.getPrimaryKey();
413
414 if (getPrimaryKey() < pk) {
415 return -1;
416 }
417 else if (getPrimaryKey() > pk) {
418 return 1;
419 }
420 else {
421 return 0;
422 }
423 }
424
425 public boolean equals(Object obj) {
426 if (obj == null) {
427 return false;
428 }
429
430 DLFileShortcut dlFileShortcut = null;
431
432 try {
433 dlFileShortcut = (DLFileShortcut)obj;
434 }
435 catch (ClassCastException cce) {
436 return false;
437 }
438
439 long pk = dlFileShortcut.getPrimaryKey();
440
441 if (getPrimaryKey() == pk) {
442 return true;
443 }
444 else {
445 return false;
446 }
447 }
448
449 public int hashCode() {
450 return (int)getPrimaryKey();
451 }
452
453 public String toString() {
454 StringBundler sb = new StringBundler(31);
455
456 sb.append("{uuid=");
457 sb.append(getUuid());
458 sb.append(", fileShortcutId=");
459 sb.append(getFileShortcutId());
460 sb.append(", groupId=");
461 sb.append(getGroupId());
462 sb.append(", companyId=");
463 sb.append(getCompanyId());
464 sb.append(", userId=");
465 sb.append(getUserId());
466 sb.append(", userName=");
467 sb.append(getUserName());
468 sb.append(", createDate=");
469 sb.append(getCreateDate());
470 sb.append(", modifiedDate=");
471 sb.append(getModifiedDate());
472 sb.append(", folderId=");
473 sb.append(getFolderId());
474 sb.append(", toFolderId=");
475 sb.append(getToFolderId());
476 sb.append(", toName=");
477 sb.append(getToName());
478 sb.append(", status=");
479 sb.append(getStatus());
480 sb.append(", statusByUserId=");
481 sb.append(getStatusByUserId());
482 sb.append(", statusByUserName=");
483 sb.append(getStatusByUserName());
484 sb.append(", statusDate=");
485 sb.append(getStatusDate());
486 sb.append("}");
487
488 return sb.toString();
489 }
490
491 public String toXmlString() {
492 StringBundler sb = new StringBundler(49);
493
494 sb.append("<model><model-name>");
495 sb.append("com.liferay.portlet.documentlibrary.model.DLFileShortcut");
496 sb.append("</model-name>");
497
498 sb.append(
499 "<column><column-name>uuid</column-name><column-value><![CDATA[");
500 sb.append(getUuid());
501 sb.append("]]></column-value></column>");
502 sb.append(
503 "<column><column-name>fileShortcutId</column-name><column-value><![CDATA[");
504 sb.append(getFileShortcutId());
505 sb.append("]]></column-value></column>");
506 sb.append(
507 "<column><column-name>groupId</column-name><column-value><![CDATA[");
508 sb.append(getGroupId());
509 sb.append("]]></column-value></column>");
510 sb.append(
511 "<column><column-name>companyId</column-name><column-value><![CDATA[");
512 sb.append(getCompanyId());
513 sb.append("]]></column-value></column>");
514 sb.append(
515 "<column><column-name>userId</column-name><column-value><![CDATA[");
516 sb.append(getUserId());
517 sb.append("]]></column-value></column>");
518 sb.append(
519 "<column><column-name>userName</column-name><column-value><![CDATA[");
520 sb.append(getUserName());
521 sb.append("]]></column-value></column>");
522 sb.append(
523 "<column><column-name>createDate</column-name><column-value><![CDATA[");
524 sb.append(getCreateDate());
525 sb.append("]]></column-value></column>");
526 sb.append(
527 "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
528 sb.append(getModifiedDate());
529 sb.append("]]></column-value></column>");
530 sb.append(
531 "<column><column-name>folderId</column-name><column-value><![CDATA[");
532 sb.append(getFolderId());
533 sb.append("]]></column-value></column>");
534 sb.append(
535 "<column><column-name>toFolderId</column-name><column-value><![CDATA[");
536 sb.append(getToFolderId());
537 sb.append("]]></column-value></column>");
538 sb.append(
539 "<column><column-name>toName</column-name><column-value><![CDATA[");
540 sb.append(getToName());
541 sb.append("]]></column-value></column>");
542 sb.append(
543 "<column><column-name>status</column-name><column-value><![CDATA[");
544 sb.append(getStatus());
545 sb.append("]]></column-value></column>");
546 sb.append(
547 "<column><column-name>statusByUserId</column-name><column-value><![CDATA[");
548 sb.append(getStatusByUserId());
549 sb.append("]]></column-value></column>");
550 sb.append(
551 "<column><column-name>statusByUserName</column-name><column-value><![CDATA[");
552 sb.append(getStatusByUserName());
553 sb.append("]]></column-value></column>");
554 sb.append(
555 "<column><column-name>statusDate</column-name><column-value><![CDATA[");
556 sb.append(getStatusDate());
557 sb.append("]]></column-value></column>");
558
559 sb.append("</model>");
560
561 return sb.toString();
562 }
563
564 private String _uuid;
565 private String _originalUuid;
566 private long _fileShortcutId;
567 private long _groupId;
568 private long _originalGroupId;
569 private boolean _setOriginalGroupId;
570 private long _companyId;
571 private long _userId;
572 private String _userUuid;
573 private String _userName;
574 private Date _createDate;
575 private Date _modifiedDate;
576 private long _folderId;
577 private long _toFolderId;
578 private String _toName;
579 private int _status;
580 private long _statusByUserId;
581 private String _statusByUserUuid;
582 private String _statusByUserName;
583 private Date _statusDate;
584 private transient ExpandoBridge _expandoBridge;
585 }