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.json.JSON;
019 import com.liferay.portal.kernel.util.DateUtil;
020 import com.liferay.portal.kernel.util.GetterUtil;
021 import com.liferay.portal.kernel.util.ProxyUtil;
022 import com.liferay.portal.kernel.util.StringBundler;
023 import com.liferay.portal.kernel.util.StringPool;
024 import com.liferay.portal.model.CacheModel;
025 import com.liferay.portal.model.impl.BaseModelImpl;
026 import com.liferay.portal.service.ServiceContext;
027
028 import com.liferay.portlet.documentlibrary.model.DLSync;
029 import com.liferay.portlet.documentlibrary.model.DLSyncModel;
030 import com.liferay.portlet.documentlibrary.model.DLSyncSoap;
031 import com.liferay.portlet.expando.model.ExpandoBridge;
032 import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
033
034 import java.io.Serializable;
035
036 import java.sql.Types;
037
038 import java.util.ArrayList;
039 import java.util.Date;
040 import java.util.HashMap;
041 import java.util.List;
042 import java.util.Map;
043
044
057 @JSON(strict = true)
058 public class DLSyncModelImpl extends BaseModelImpl<DLSync>
059 implements DLSyncModel {
060
065 public static final String TABLE_NAME = "DLSync";
066 public static final Object[][] TABLE_COLUMNS = {
067 { "syncId", Types.BIGINT },
068 { "companyId", Types.BIGINT },
069 { "createDate", Types.TIMESTAMP },
070 { "modifiedDate", Types.TIMESTAMP },
071 { "fileId", Types.BIGINT },
072 { "fileUuid", Types.VARCHAR },
073 { "repositoryId", Types.BIGINT },
074 { "parentFolderId", Types.BIGINT },
075 { "name", Types.VARCHAR },
076 { "description", Types.VARCHAR },
077 { "event", Types.VARCHAR },
078 { "type_", Types.VARCHAR },
079 { "version", Types.VARCHAR }
080 };
081 public static final String TABLE_SQL_CREATE = "create table DLSync (syncId LONG not null primary key,companyId LONG,createDate DATE null,modifiedDate DATE null,fileId LONG,fileUuid VARCHAR(75) null,repositoryId LONG,parentFolderId LONG,name VARCHAR(255) null,description STRING null,event VARCHAR(75) null,type_ VARCHAR(75) null,version VARCHAR(75) null)";
082 public static final String TABLE_SQL_DROP = "drop table DLSync";
083 public static final String ORDER_BY_JPQL = " ORDER BY dlSync.companyId ASC, dlSync.repositoryId ASC, dlSync.modifiedDate ASC";
084 public static final String ORDER_BY_SQL = " ORDER BY DLSync.companyId ASC, DLSync.repositoryId ASC, DLSync.modifiedDate ASC";
085 public static final String DATA_SOURCE = "liferayDataSource";
086 public static final String SESSION_FACTORY = "liferaySessionFactory";
087 public static final String TX_MANAGER = "liferayTransactionManager";
088 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
089 "value.object.entity.cache.enabled.com.liferay.portlet.documentlibrary.model.DLSync"),
090 true);
091 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
092 "value.object.finder.cache.enabled.com.liferay.portlet.documentlibrary.model.DLSync"),
093 true);
094 public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
095 "value.object.column.bitmask.enabled.com.liferay.portlet.documentlibrary.model.DLSync"),
096 true);
097 public static long COMPANYID_COLUMN_BITMASK = 1L;
098 public static long FILEID_COLUMN_BITMASK = 2L;
099 public static long MODIFIEDDATE_COLUMN_BITMASK = 4L;
100 public static long REPOSITORYID_COLUMN_BITMASK = 8L;
101
102
108 public static DLSync toModel(DLSyncSoap soapModel) {
109 if (soapModel == null) {
110 return null;
111 }
112
113 DLSync model = new DLSyncImpl();
114
115 model.setSyncId(soapModel.getSyncId());
116 model.setCompanyId(soapModel.getCompanyId());
117 model.setCreateDate(soapModel.getCreateDate());
118 model.setModifiedDate(soapModel.getModifiedDate());
119 model.setFileId(soapModel.getFileId());
120 model.setFileUuid(soapModel.getFileUuid());
121 model.setRepositoryId(soapModel.getRepositoryId());
122 model.setParentFolderId(soapModel.getParentFolderId());
123 model.setName(soapModel.getName());
124 model.setDescription(soapModel.getDescription());
125 model.setEvent(soapModel.getEvent());
126 model.setType(soapModel.getType());
127 model.setVersion(soapModel.getVersion());
128
129 return model;
130 }
131
132
138 public static List<DLSync> toModels(DLSyncSoap[] soapModels) {
139 if (soapModels == null) {
140 return null;
141 }
142
143 List<DLSync> models = new ArrayList<DLSync>(soapModels.length);
144
145 for (DLSyncSoap soapModel : soapModels) {
146 models.add(toModel(soapModel));
147 }
148
149 return models;
150 }
151
152 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
153 "lock.expiration.time.com.liferay.portlet.documentlibrary.model.DLSync"));
154
155 public DLSyncModelImpl() {
156 }
157
158 public long getPrimaryKey() {
159 return _syncId;
160 }
161
162 public void setPrimaryKey(long primaryKey) {
163 setSyncId(primaryKey);
164 }
165
166 public Serializable getPrimaryKeyObj() {
167 return new Long(_syncId);
168 }
169
170 public void setPrimaryKeyObj(Serializable primaryKeyObj) {
171 setPrimaryKey(((Long)primaryKeyObj).longValue());
172 }
173
174 public Class<?> getModelClass() {
175 return DLSync.class;
176 }
177
178 public String getModelClassName() {
179 return DLSync.class.getName();
180 }
181
182 @Override
183 public Map<String, Object> getModelAttributes() {
184 Map<String, Object> attributes = new HashMap<String, Object>();
185
186 attributes.put("syncId", getSyncId());
187 attributes.put("companyId", getCompanyId());
188 attributes.put("createDate", getCreateDate());
189 attributes.put("modifiedDate", getModifiedDate());
190 attributes.put("fileId", getFileId());
191 attributes.put("fileUuid", getFileUuid());
192 attributes.put("repositoryId", getRepositoryId());
193 attributes.put("parentFolderId", getParentFolderId());
194 attributes.put("name", getName());
195 attributes.put("description", getDescription());
196 attributes.put("event", getEvent());
197 attributes.put("type", getType());
198 attributes.put("version", getVersion());
199
200 return attributes;
201 }
202
203 @Override
204 public void setModelAttributes(Map<String, Object> attributes) {
205 Long syncId = (Long)attributes.get("syncId");
206
207 if (syncId != null) {
208 setSyncId(syncId);
209 }
210
211 Long companyId = (Long)attributes.get("companyId");
212
213 if (companyId != null) {
214 setCompanyId(companyId);
215 }
216
217 Date createDate = (Date)attributes.get("createDate");
218
219 if (createDate != null) {
220 setCreateDate(createDate);
221 }
222
223 Date modifiedDate = (Date)attributes.get("modifiedDate");
224
225 if (modifiedDate != null) {
226 setModifiedDate(modifiedDate);
227 }
228
229 Long fileId = (Long)attributes.get("fileId");
230
231 if (fileId != null) {
232 setFileId(fileId);
233 }
234
235 String fileUuid = (String)attributes.get("fileUuid");
236
237 if (fileUuid != null) {
238 setFileUuid(fileUuid);
239 }
240
241 Long repositoryId = (Long)attributes.get("repositoryId");
242
243 if (repositoryId != null) {
244 setRepositoryId(repositoryId);
245 }
246
247 Long parentFolderId = (Long)attributes.get("parentFolderId");
248
249 if (parentFolderId != null) {
250 setParentFolderId(parentFolderId);
251 }
252
253 String name = (String)attributes.get("name");
254
255 if (name != null) {
256 setName(name);
257 }
258
259 String description = (String)attributes.get("description");
260
261 if (description != null) {
262 setDescription(description);
263 }
264
265 String event = (String)attributes.get("event");
266
267 if (event != null) {
268 setEvent(event);
269 }
270
271 String type = (String)attributes.get("type");
272
273 if (type != null) {
274 setType(type);
275 }
276
277 String version = (String)attributes.get("version");
278
279 if (version != null) {
280 setVersion(version);
281 }
282 }
283
284 @JSON
285 public long getSyncId() {
286 return _syncId;
287 }
288
289 public void setSyncId(long syncId) {
290 _syncId = syncId;
291 }
292
293 @JSON
294 public long getCompanyId() {
295 return _companyId;
296 }
297
298 public void setCompanyId(long companyId) {
299 _columnBitmask = -1L;
300
301 if (!_setOriginalCompanyId) {
302 _setOriginalCompanyId = true;
303
304 _originalCompanyId = _companyId;
305 }
306
307 _companyId = companyId;
308 }
309
310 public long getOriginalCompanyId() {
311 return _originalCompanyId;
312 }
313
314 @JSON
315 public Date getCreateDate() {
316 return _createDate;
317 }
318
319 public void setCreateDate(Date createDate) {
320 _createDate = createDate;
321 }
322
323 @JSON
324 public Date getModifiedDate() {
325 return _modifiedDate;
326 }
327
328 public void setModifiedDate(Date modifiedDate) {
329 _columnBitmask = -1L;
330
331 if (_originalModifiedDate == null) {
332 _originalModifiedDate = _modifiedDate;
333 }
334
335 _modifiedDate = modifiedDate;
336 }
337
338 public Date getOriginalModifiedDate() {
339 return _originalModifiedDate;
340 }
341
342 @JSON
343 public long getFileId() {
344 return _fileId;
345 }
346
347 public void setFileId(long fileId) {
348 _columnBitmask |= FILEID_COLUMN_BITMASK;
349
350 if (!_setOriginalFileId) {
351 _setOriginalFileId = true;
352
353 _originalFileId = _fileId;
354 }
355
356 _fileId = fileId;
357 }
358
359 public long getOriginalFileId() {
360 return _originalFileId;
361 }
362
363 @JSON
364 public String getFileUuid() {
365 if (_fileUuid == null) {
366 return StringPool.BLANK;
367 }
368 else {
369 return _fileUuid;
370 }
371 }
372
373 public void setFileUuid(String fileUuid) {
374 _fileUuid = fileUuid;
375 }
376
377 @JSON
378 public long getRepositoryId() {
379 return _repositoryId;
380 }
381
382 public void setRepositoryId(long repositoryId) {
383 _columnBitmask = -1L;
384
385 if (!_setOriginalRepositoryId) {
386 _setOriginalRepositoryId = true;
387
388 _originalRepositoryId = _repositoryId;
389 }
390
391 _repositoryId = repositoryId;
392 }
393
394 public long getOriginalRepositoryId() {
395 return _originalRepositoryId;
396 }
397
398 @JSON
399 public long getParentFolderId() {
400 return _parentFolderId;
401 }
402
403 public void setParentFolderId(long parentFolderId) {
404 _parentFolderId = parentFolderId;
405 }
406
407 @JSON
408 public String getName() {
409 if (_name == null) {
410 return StringPool.BLANK;
411 }
412 else {
413 return _name;
414 }
415 }
416
417 public void setName(String name) {
418 _name = name;
419 }
420
421 @JSON
422 public String getDescription() {
423 if (_description == null) {
424 return StringPool.BLANK;
425 }
426 else {
427 return _description;
428 }
429 }
430
431 public void setDescription(String description) {
432 _description = description;
433 }
434
435 @JSON
436 public String getEvent() {
437 if (_event == null) {
438 return StringPool.BLANK;
439 }
440 else {
441 return _event;
442 }
443 }
444
445 public void setEvent(String event) {
446 _event = event;
447 }
448
449 @JSON
450 public String getType() {
451 if (_type == null) {
452 return StringPool.BLANK;
453 }
454 else {
455 return _type;
456 }
457 }
458
459 public void setType(String type) {
460 _type = type;
461 }
462
463 @JSON
464 public String getVersion() {
465 if (_version == null) {
466 return StringPool.BLANK;
467 }
468 else {
469 return _version;
470 }
471 }
472
473 public void setVersion(String version) {
474 _version = version;
475 }
476
477 public long getColumnBitmask() {
478 return _columnBitmask;
479 }
480
481 @Override
482 public ExpandoBridge getExpandoBridge() {
483 return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
484 DLSync.class.getName(), getPrimaryKey());
485 }
486
487 @Override
488 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
489 ExpandoBridge expandoBridge = getExpandoBridge();
490
491 expandoBridge.setAttributes(serviceContext);
492 }
493
494 @Override
495 public DLSync toEscapedModel() {
496 if (_escapedModel == null) {
497 _escapedModel = (DLSync)ProxyUtil.newProxyInstance(_classLoader,
498 _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
499 }
500
501 return _escapedModel;
502 }
503
504 @Override
505 public Object clone() {
506 DLSyncImpl dlSyncImpl = new DLSyncImpl();
507
508 dlSyncImpl.setSyncId(getSyncId());
509 dlSyncImpl.setCompanyId(getCompanyId());
510 dlSyncImpl.setCreateDate(getCreateDate());
511 dlSyncImpl.setModifiedDate(getModifiedDate());
512 dlSyncImpl.setFileId(getFileId());
513 dlSyncImpl.setFileUuid(getFileUuid());
514 dlSyncImpl.setRepositoryId(getRepositoryId());
515 dlSyncImpl.setParentFolderId(getParentFolderId());
516 dlSyncImpl.setName(getName());
517 dlSyncImpl.setDescription(getDescription());
518 dlSyncImpl.setEvent(getEvent());
519 dlSyncImpl.setType(getType());
520 dlSyncImpl.setVersion(getVersion());
521
522 dlSyncImpl.resetOriginalValues();
523
524 return dlSyncImpl;
525 }
526
527 public int compareTo(DLSync dlSync) {
528 int value = 0;
529
530 if (getCompanyId() < dlSync.getCompanyId()) {
531 value = -1;
532 }
533 else if (getCompanyId() > dlSync.getCompanyId()) {
534 value = 1;
535 }
536 else {
537 value = 0;
538 }
539
540 if (value != 0) {
541 return value;
542 }
543
544 if (getRepositoryId() < dlSync.getRepositoryId()) {
545 value = -1;
546 }
547 else if (getRepositoryId() > dlSync.getRepositoryId()) {
548 value = 1;
549 }
550 else {
551 value = 0;
552 }
553
554 if (value != 0) {
555 return value;
556 }
557
558 value = DateUtil.compareTo(getModifiedDate(), dlSync.getModifiedDate());
559
560 if (value != 0) {
561 return value;
562 }
563
564 return 0;
565 }
566
567 @Override
568 public boolean equals(Object obj) {
569 if (obj == null) {
570 return false;
571 }
572
573 DLSync dlSync = null;
574
575 try {
576 dlSync = (DLSync)obj;
577 }
578 catch (ClassCastException cce) {
579 return false;
580 }
581
582 long primaryKey = dlSync.getPrimaryKey();
583
584 if (getPrimaryKey() == primaryKey) {
585 return true;
586 }
587 else {
588 return false;
589 }
590 }
591
592 @Override
593 public int hashCode() {
594 return (int)getPrimaryKey();
595 }
596
597 @Override
598 public void resetOriginalValues() {
599 DLSyncModelImpl dlSyncModelImpl = this;
600
601 dlSyncModelImpl._originalCompanyId = dlSyncModelImpl._companyId;
602
603 dlSyncModelImpl._setOriginalCompanyId = false;
604
605 dlSyncModelImpl._originalModifiedDate = dlSyncModelImpl._modifiedDate;
606
607 dlSyncModelImpl._originalFileId = dlSyncModelImpl._fileId;
608
609 dlSyncModelImpl._setOriginalFileId = false;
610
611 dlSyncModelImpl._originalRepositoryId = dlSyncModelImpl._repositoryId;
612
613 dlSyncModelImpl._setOriginalRepositoryId = false;
614
615 dlSyncModelImpl._columnBitmask = 0;
616 }
617
618 @Override
619 public CacheModel<DLSync> toCacheModel() {
620 DLSyncCacheModel dlSyncCacheModel = new DLSyncCacheModel();
621
622 dlSyncCacheModel.syncId = getSyncId();
623
624 dlSyncCacheModel.companyId = getCompanyId();
625
626 Date createDate = getCreateDate();
627
628 if (createDate != null) {
629 dlSyncCacheModel.createDate = createDate.getTime();
630 }
631 else {
632 dlSyncCacheModel.createDate = Long.MIN_VALUE;
633 }
634
635 Date modifiedDate = getModifiedDate();
636
637 if (modifiedDate != null) {
638 dlSyncCacheModel.modifiedDate = modifiedDate.getTime();
639 }
640 else {
641 dlSyncCacheModel.modifiedDate = Long.MIN_VALUE;
642 }
643
644 dlSyncCacheModel.fileId = getFileId();
645
646 dlSyncCacheModel.fileUuid = getFileUuid();
647
648 String fileUuid = dlSyncCacheModel.fileUuid;
649
650 if ((fileUuid != null) && (fileUuid.length() == 0)) {
651 dlSyncCacheModel.fileUuid = null;
652 }
653
654 dlSyncCacheModel.repositoryId = getRepositoryId();
655
656 dlSyncCacheModel.parentFolderId = getParentFolderId();
657
658 dlSyncCacheModel.name = getName();
659
660 String name = dlSyncCacheModel.name;
661
662 if ((name != null) && (name.length() == 0)) {
663 dlSyncCacheModel.name = null;
664 }
665
666 dlSyncCacheModel.description = getDescription();
667
668 String description = dlSyncCacheModel.description;
669
670 if ((description != null) && (description.length() == 0)) {
671 dlSyncCacheModel.description = null;
672 }
673
674 dlSyncCacheModel.event = getEvent();
675
676 String event = dlSyncCacheModel.event;
677
678 if ((event != null) && (event.length() == 0)) {
679 dlSyncCacheModel.event = null;
680 }
681
682 dlSyncCacheModel.type = getType();
683
684 String type = dlSyncCacheModel.type;
685
686 if ((type != null) && (type.length() == 0)) {
687 dlSyncCacheModel.type = null;
688 }
689
690 dlSyncCacheModel.version = getVersion();
691
692 String version = dlSyncCacheModel.version;
693
694 if ((version != null) && (version.length() == 0)) {
695 dlSyncCacheModel.version = null;
696 }
697
698 return dlSyncCacheModel;
699 }
700
701 @Override
702 public String toString() {
703 StringBundler sb = new StringBundler(27);
704
705 sb.append("{syncId=");
706 sb.append(getSyncId());
707 sb.append(", companyId=");
708 sb.append(getCompanyId());
709 sb.append(", createDate=");
710 sb.append(getCreateDate());
711 sb.append(", modifiedDate=");
712 sb.append(getModifiedDate());
713 sb.append(", fileId=");
714 sb.append(getFileId());
715 sb.append(", fileUuid=");
716 sb.append(getFileUuid());
717 sb.append(", repositoryId=");
718 sb.append(getRepositoryId());
719 sb.append(", parentFolderId=");
720 sb.append(getParentFolderId());
721 sb.append(", name=");
722 sb.append(getName());
723 sb.append(", description=");
724 sb.append(getDescription());
725 sb.append(", event=");
726 sb.append(getEvent());
727 sb.append(", type=");
728 sb.append(getType());
729 sb.append(", version=");
730 sb.append(getVersion());
731 sb.append("}");
732
733 return sb.toString();
734 }
735
736 public String toXmlString() {
737 StringBundler sb = new StringBundler(43);
738
739 sb.append("<model><model-name>");
740 sb.append("com.liferay.portlet.documentlibrary.model.DLSync");
741 sb.append("</model-name>");
742
743 sb.append(
744 "<column><column-name>syncId</column-name><column-value><![CDATA[");
745 sb.append(getSyncId());
746 sb.append("]]></column-value></column>");
747 sb.append(
748 "<column><column-name>companyId</column-name><column-value><![CDATA[");
749 sb.append(getCompanyId());
750 sb.append("]]></column-value></column>");
751 sb.append(
752 "<column><column-name>createDate</column-name><column-value><![CDATA[");
753 sb.append(getCreateDate());
754 sb.append("]]></column-value></column>");
755 sb.append(
756 "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
757 sb.append(getModifiedDate());
758 sb.append("]]></column-value></column>");
759 sb.append(
760 "<column><column-name>fileId</column-name><column-value><![CDATA[");
761 sb.append(getFileId());
762 sb.append("]]></column-value></column>");
763 sb.append(
764 "<column><column-name>fileUuid</column-name><column-value><![CDATA[");
765 sb.append(getFileUuid());
766 sb.append("]]></column-value></column>");
767 sb.append(
768 "<column><column-name>repositoryId</column-name><column-value><![CDATA[");
769 sb.append(getRepositoryId());
770 sb.append("]]></column-value></column>");
771 sb.append(
772 "<column><column-name>parentFolderId</column-name><column-value><![CDATA[");
773 sb.append(getParentFolderId());
774 sb.append("]]></column-value></column>");
775 sb.append(
776 "<column><column-name>name</column-name><column-value><![CDATA[");
777 sb.append(getName());
778 sb.append("]]></column-value></column>");
779 sb.append(
780 "<column><column-name>description</column-name><column-value><![CDATA[");
781 sb.append(getDescription());
782 sb.append("]]></column-value></column>");
783 sb.append(
784 "<column><column-name>event</column-name><column-value><![CDATA[");
785 sb.append(getEvent());
786 sb.append("]]></column-value></column>");
787 sb.append(
788 "<column><column-name>type</column-name><column-value><![CDATA[");
789 sb.append(getType());
790 sb.append("]]></column-value></column>");
791 sb.append(
792 "<column><column-name>version</column-name><column-value><![CDATA[");
793 sb.append(getVersion());
794 sb.append("]]></column-value></column>");
795
796 sb.append("</model>");
797
798 return sb.toString();
799 }
800
801 private static ClassLoader _classLoader = DLSync.class.getClassLoader();
802 private static Class<?>[] _escapedModelInterfaces = new Class[] { DLSync.class };
803 private long _syncId;
804 private long _companyId;
805 private long _originalCompanyId;
806 private boolean _setOriginalCompanyId;
807 private Date _createDate;
808 private Date _modifiedDate;
809 private Date _originalModifiedDate;
810 private long _fileId;
811 private long _originalFileId;
812 private boolean _setOriginalFileId;
813 private String _fileUuid;
814 private long _repositoryId;
815 private long _originalRepositoryId;
816 private boolean _setOriginalRepositoryId;
817 private long _parentFolderId;
818 private String _name;
819 private String _description;
820 private String _event;
821 private String _type;
822 private String _version;
823 private long _columnBitmask;
824 private DLSync _escapedModel;
825 }