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 public DLSync toUnescapedModel() {
505 return (DLSync)this;
506 }
507
508 @Override
509 public Object clone() {
510 DLSyncImpl dlSyncImpl = new DLSyncImpl();
511
512 dlSyncImpl.setSyncId(getSyncId());
513 dlSyncImpl.setCompanyId(getCompanyId());
514 dlSyncImpl.setCreateDate(getCreateDate());
515 dlSyncImpl.setModifiedDate(getModifiedDate());
516 dlSyncImpl.setFileId(getFileId());
517 dlSyncImpl.setFileUuid(getFileUuid());
518 dlSyncImpl.setRepositoryId(getRepositoryId());
519 dlSyncImpl.setParentFolderId(getParentFolderId());
520 dlSyncImpl.setName(getName());
521 dlSyncImpl.setDescription(getDescription());
522 dlSyncImpl.setEvent(getEvent());
523 dlSyncImpl.setType(getType());
524 dlSyncImpl.setVersion(getVersion());
525
526 dlSyncImpl.resetOriginalValues();
527
528 return dlSyncImpl;
529 }
530
531 public int compareTo(DLSync dlSync) {
532 int value = 0;
533
534 if (getCompanyId() < dlSync.getCompanyId()) {
535 value = -1;
536 }
537 else if (getCompanyId() > dlSync.getCompanyId()) {
538 value = 1;
539 }
540 else {
541 value = 0;
542 }
543
544 if (value != 0) {
545 return value;
546 }
547
548 if (getRepositoryId() < dlSync.getRepositoryId()) {
549 value = -1;
550 }
551 else if (getRepositoryId() > dlSync.getRepositoryId()) {
552 value = 1;
553 }
554 else {
555 value = 0;
556 }
557
558 if (value != 0) {
559 return value;
560 }
561
562 value = DateUtil.compareTo(getModifiedDate(), dlSync.getModifiedDate());
563
564 if (value != 0) {
565 return value;
566 }
567
568 return 0;
569 }
570
571 @Override
572 public boolean equals(Object obj) {
573 if (this == obj) {
574 return true;
575 }
576
577 if (!(obj instanceof DLSync)) {
578 return false;
579 }
580
581 DLSync dlSync = (DLSync)obj;
582
583 long primaryKey = dlSync.getPrimaryKey();
584
585 if (getPrimaryKey() == primaryKey) {
586 return true;
587 }
588 else {
589 return false;
590 }
591 }
592
593 @Override
594 public int hashCode() {
595 return (int)getPrimaryKey();
596 }
597
598 @Override
599 public void resetOriginalValues() {
600 DLSyncModelImpl dlSyncModelImpl = this;
601
602 dlSyncModelImpl._originalCompanyId = dlSyncModelImpl._companyId;
603
604 dlSyncModelImpl._setOriginalCompanyId = false;
605
606 dlSyncModelImpl._originalModifiedDate = dlSyncModelImpl._modifiedDate;
607
608 dlSyncModelImpl._originalFileId = dlSyncModelImpl._fileId;
609
610 dlSyncModelImpl._setOriginalFileId = false;
611
612 dlSyncModelImpl._originalRepositoryId = dlSyncModelImpl._repositoryId;
613
614 dlSyncModelImpl._setOriginalRepositoryId = false;
615
616 dlSyncModelImpl._columnBitmask = 0;
617 }
618
619 @Override
620 public CacheModel<DLSync> toCacheModel() {
621 DLSyncCacheModel dlSyncCacheModel = new DLSyncCacheModel();
622
623 dlSyncCacheModel.syncId = getSyncId();
624
625 dlSyncCacheModel.companyId = getCompanyId();
626
627 Date createDate = getCreateDate();
628
629 if (createDate != null) {
630 dlSyncCacheModel.createDate = createDate.getTime();
631 }
632 else {
633 dlSyncCacheModel.createDate = Long.MIN_VALUE;
634 }
635
636 Date modifiedDate = getModifiedDate();
637
638 if (modifiedDate != null) {
639 dlSyncCacheModel.modifiedDate = modifiedDate.getTime();
640 }
641 else {
642 dlSyncCacheModel.modifiedDate = Long.MIN_VALUE;
643 }
644
645 dlSyncCacheModel.fileId = getFileId();
646
647 dlSyncCacheModel.fileUuid = getFileUuid();
648
649 String fileUuid = dlSyncCacheModel.fileUuid;
650
651 if ((fileUuid != null) && (fileUuid.length() == 0)) {
652 dlSyncCacheModel.fileUuid = null;
653 }
654
655 dlSyncCacheModel.repositoryId = getRepositoryId();
656
657 dlSyncCacheModel.parentFolderId = getParentFolderId();
658
659 dlSyncCacheModel.name = getName();
660
661 String name = dlSyncCacheModel.name;
662
663 if ((name != null) && (name.length() == 0)) {
664 dlSyncCacheModel.name = null;
665 }
666
667 dlSyncCacheModel.description = getDescription();
668
669 String description = dlSyncCacheModel.description;
670
671 if ((description != null) && (description.length() == 0)) {
672 dlSyncCacheModel.description = null;
673 }
674
675 dlSyncCacheModel.event = getEvent();
676
677 String event = dlSyncCacheModel.event;
678
679 if ((event != null) && (event.length() == 0)) {
680 dlSyncCacheModel.event = null;
681 }
682
683 dlSyncCacheModel.type = getType();
684
685 String type = dlSyncCacheModel.type;
686
687 if ((type != null) && (type.length() == 0)) {
688 dlSyncCacheModel.type = null;
689 }
690
691 dlSyncCacheModel.version = getVersion();
692
693 String version = dlSyncCacheModel.version;
694
695 if ((version != null) && (version.length() == 0)) {
696 dlSyncCacheModel.version = null;
697 }
698
699 return dlSyncCacheModel;
700 }
701
702 @Override
703 public String toString() {
704 StringBundler sb = new StringBundler(27);
705
706 sb.append("{syncId=");
707 sb.append(getSyncId());
708 sb.append(", companyId=");
709 sb.append(getCompanyId());
710 sb.append(", createDate=");
711 sb.append(getCreateDate());
712 sb.append(", modifiedDate=");
713 sb.append(getModifiedDate());
714 sb.append(", fileId=");
715 sb.append(getFileId());
716 sb.append(", fileUuid=");
717 sb.append(getFileUuid());
718 sb.append(", repositoryId=");
719 sb.append(getRepositoryId());
720 sb.append(", parentFolderId=");
721 sb.append(getParentFolderId());
722 sb.append(", name=");
723 sb.append(getName());
724 sb.append(", description=");
725 sb.append(getDescription());
726 sb.append(", event=");
727 sb.append(getEvent());
728 sb.append(", type=");
729 sb.append(getType());
730 sb.append(", version=");
731 sb.append(getVersion());
732 sb.append("}");
733
734 return sb.toString();
735 }
736
737 public String toXmlString() {
738 StringBundler sb = new StringBundler(43);
739
740 sb.append("<model><model-name>");
741 sb.append("com.liferay.portlet.documentlibrary.model.DLSync");
742 sb.append("</model-name>");
743
744 sb.append(
745 "<column><column-name>syncId</column-name><column-value><![CDATA[");
746 sb.append(getSyncId());
747 sb.append("]]></column-value></column>");
748 sb.append(
749 "<column><column-name>companyId</column-name><column-value><![CDATA[");
750 sb.append(getCompanyId());
751 sb.append("]]></column-value></column>");
752 sb.append(
753 "<column><column-name>createDate</column-name><column-value><![CDATA[");
754 sb.append(getCreateDate());
755 sb.append("]]></column-value></column>");
756 sb.append(
757 "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
758 sb.append(getModifiedDate());
759 sb.append("]]></column-value></column>");
760 sb.append(
761 "<column><column-name>fileId</column-name><column-value><![CDATA[");
762 sb.append(getFileId());
763 sb.append("]]></column-value></column>");
764 sb.append(
765 "<column><column-name>fileUuid</column-name><column-value><![CDATA[");
766 sb.append(getFileUuid());
767 sb.append("]]></column-value></column>");
768 sb.append(
769 "<column><column-name>repositoryId</column-name><column-value><![CDATA[");
770 sb.append(getRepositoryId());
771 sb.append("]]></column-value></column>");
772 sb.append(
773 "<column><column-name>parentFolderId</column-name><column-value><![CDATA[");
774 sb.append(getParentFolderId());
775 sb.append("]]></column-value></column>");
776 sb.append(
777 "<column><column-name>name</column-name><column-value><![CDATA[");
778 sb.append(getName());
779 sb.append("]]></column-value></column>");
780 sb.append(
781 "<column><column-name>description</column-name><column-value><![CDATA[");
782 sb.append(getDescription());
783 sb.append("]]></column-value></column>");
784 sb.append(
785 "<column><column-name>event</column-name><column-value><![CDATA[");
786 sb.append(getEvent());
787 sb.append("]]></column-value></column>");
788 sb.append(
789 "<column><column-name>type</column-name><column-value><![CDATA[");
790 sb.append(getType());
791 sb.append("]]></column-value></column>");
792 sb.append(
793 "<column><column-name>version</column-name><column-value><![CDATA[");
794 sb.append(getVersion());
795 sb.append("]]></column-value></column>");
796
797 sb.append("</model>");
798
799 return sb.toString();
800 }
801
802 private static ClassLoader _classLoader = DLSync.class.getClassLoader();
803 private static Class<?>[] _escapedModelInterfaces = new Class[] { DLSync.class };
804 private long _syncId;
805 private long _companyId;
806 private long _originalCompanyId;
807 private boolean _setOriginalCompanyId;
808 private Date _createDate;
809 private Date _modifiedDate;
810 private Date _originalModifiedDate;
811 private long _fileId;
812 private long _originalFileId;
813 private boolean _setOriginalFileId;
814 private String _fileUuid;
815 private long _repositoryId;
816 private long _originalRepositoryId;
817 private boolean _setOriginalRepositoryId;
818 private long _parentFolderId;
819 private String _name;
820 private String _description;
821 private String _event;
822 private String _type;
823 private String _version;
824 private long _columnBitmask;
825 private DLSync _escapedModel;
826 }