001
014
015 package com.liferay.portlet.dynamicdatamapping.model.impl;
016
017 import com.liferay.portal.LocaleException;
018 import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
019 import com.liferay.portal.kernel.exception.SystemException;
020 import com.liferay.portal.kernel.json.JSON;
021 import com.liferay.portal.kernel.language.LanguageUtil;
022 import com.liferay.portal.kernel.util.GetterUtil;
023 import com.liferay.portal.kernel.util.LocaleUtil;
024 import com.liferay.portal.kernel.util.LocalizationUtil;
025 import com.liferay.portal.kernel.util.ProxyUtil;
026 import com.liferay.portal.kernel.util.StringBundler;
027 import com.liferay.portal.kernel.util.StringPool;
028 import com.liferay.portal.kernel.util.Validator;
029 import com.liferay.portal.model.CacheModel;
030 import com.liferay.portal.model.impl.BaseModelImpl;
031 import com.liferay.portal.service.ServiceContext;
032 import com.liferay.portal.util.PortalUtil;
033
034 import com.liferay.portlet.dynamicdatamapping.model.DDMStructure;
035 import com.liferay.portlet.dynamicdatamapping.model.DDMStructureModel;
036 import com.liferay.portlet.dynamicdatamapping.model.DDMStructureSoap;
037 import com.liferay.portlet.expando.model.ExpandoBridge;
038 import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
039
040 import java.io.Serializable;
041
042 import java.sql.Types;
043
044 import java.util.ArrayList;
045 import java.util.Date;
046 import java.util.HashMap;
047 import java.util.List;
048 import java.util.Locale;
049 import java.util.Map;
050
051
064 @JSON(strict = true)
065 public class DDMStructureModelImpl extends BaseModelImpl<DDMStructure>
066 implements DDMStructureModel {
067
072 public static final String TABLE_NAME = "DDMStructure";
073 public static final Object[][] TABLE_COLUMNS = {
074 { "uuid_", Types.VARCHAR },
075 { "structureId", Types.BIGINT },
076 { "groupId", Types.BIGINT },
077 { "companyId", Types.BIGINT },
078 { "userId", Types.BIGINT },
079 { "userName", Types.VARCHAR },
080 { "createDate", Types.TIMESTAMP },
081 { "modifiedDate", Types.TIMESTAMP },
082 { "classNameId", Types.BIGINT },
083 { "structureKey", Types.VARCHAR },
084 { "name", Types.VARCHAR },
085 { "description", Types.VARCHAR },
086 { "xsd", Types.CLOB },
087 { "storageType", Types.VARCHAR },
088 { "type_", Types.INTEGER }
089 };
090 public static final String TABLE_SQL_CREATE = "create table DDMStructure (uuid_ VARCHAR(75) null,structureId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,classNameId LONG,structureKey VARCHAR(75) null,name STRING null,description STRING null,xsd TEXT null,storageType VARCHAR(75) null,type_ INTEGER)";
091 public static final String TABLE_SQL_DROP = "drop table DDMStructure";
092 public static final String DATA_SOURCE = "liferayDataSource";
093 public static final String SESSION_FACTORY = "liferaySessionFactory";
094 public static final String TX_MANAGER = "liferayTransactionManager";
095 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
096 "value.object.entity.cache.enabled.com.liferay.portlet.dynamicdatamapping.model.DDMStructure"),
097 true);
098 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
099 "value.object.finder.cache.enabled.com.liferay.portlet.dynamicdatamapping.model.DDMStructure"),
100 true);
101 public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
102 "value.object.column.bitmask.enabled.com.liferay.portlet.dynamicdatamapping.model.DDMStructure"),
103 true);
104 public static long CLASSNAMEID_COLUMN_BITMASK = 1L;
105 public static long COMPANYID_COLUMN_BITMASK = 2L;
106 public static long DESCRIPTION_COLUMN_BITMASK = 4L;
107 public static long GROUPID_COLUMN_BITMASK = 8L;
108 public static long NAME_COLUMN_BITMASK = 16L;
109 public static long STRUCTUREKEY_COLUMN_BITMASK = 32L;
110 public static long UUID_COLUMN_BITMASK = 64L;
111
112
118 public static DDMStructure toModel(DDMStructureSoap soapModel) {
119 if (soapModel == null) {
120 return null;
121 }
122
123 DDMStructure model = new DDMStructureImpl();
124
125 model.setUuid(soapModel.getUuid());
126 model.setStructureId(soapModel.getStructureId());
127 model.setGroupId(soapModel.getGroupId());
128 model.setCompanyId(soapModel.getCompanyId());
129 model.setUserId(soapModel.getUserId());
130 model.setUserName(soapModel.getUserName());
131 model.setCreateDate(soapModel.getCreateDate());
132 model.setModifiedDate(soapModel.getModifiedDate());
133 model.setClassNameId(soapModel.getClassNameId());
134 model.setStructureKey(soapModel.getStructureKey());
135 model.setName(soapModel.getName());
136 model.setDescription(soapModel.getDescription());
137 model.setXsd(soapModel.getXsd());
138 model.setStorageType(soapModel.getStorageType());
139 model.setType(soapModel.getType());
140
141 return model;
142 }
143
144
150 public static List<DDMStructure> toModels(DDMStructureSoap[] soapModels) {
151 if (soapModels == null) {
152 return null;
153 }
154
155 List<DDMStructure> models = new ArrayList<DDMStructure>(soapModels.length);
156
157 for (DDMStructureSoap soapModel : soapModels) {
158 models.add(toModel(soapModel));
159 }
160
161 return models;
162 }
163
164 public static final String MAPPING_TABLE_DLFILEENTRYTYPES_DDMSTRUCTURES_NAME =
165 "DLFileEntryTypes_DDMStructures";
166 public static final Object[][] MAPPING_TABLE_DLFILEENTRYTYPES_DDMSTRUCTURES_COLUMNS =
167 {
168 { "structureId", Types.BIGINT },
169 { "fileEntryTypeId", Types.BIGINT }
170 };
171 public static final String MAPPING_TABLE_DLFILEENTRYTYPES_DDMSTRUCTURES_SQL_CREATE =
172 "create table DLFileEntryTypes_DDMStructures (structureId LONG not null,fileEntryTypeId LONG not null,primary key (structureId, fileEntryTypeId))";
173 public static final boolean FINDER_CACHE_ENABLED_DLFILEENTRYTYPES_DDMSTRUCTURES =
174 GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
175 "value.object.finder.cache.enabled.DLFileEntryTypes_DDMStructures"),
176 true);
177 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
178 "lock.expiration.time.com.liferay.portlet.dynamicdatamapping.model.DDMStructure"));
179
180 public DDMStructureModelImpl() {
181 }
182
183 public long getPrimaryKey() {
184 return _structureId;
185 }
186
187 public void setPrimaryKey(long primaryKey) {
188 setStructureId(primaryKey);
189 }
190
191 public Serializable getPrimaryKeyObj() {
192 return new Long(_structureId);
193 }
194
195 public void setPrimaryKeyObj(Serializable primaryKeyObj) {
196 setPrimaryKey(((Long)primaryKeyObj).longValue());
197 }
198
199 public Class<?> getModelClass() {
200 return DDMStructure.class;
201 }
202
203 public String getModelClassName() {
204 return DDMStructure.class.getName();
205 }
206
207 @Override
208 public Map<String, Object> getModelAttributes() {
209 Map<String, Object> attributes = new HashMap<String, Object>();
210
211 attributes.put("uuid", getUuid());
212 attributes.put("structureId", getStructureId());
213 attributes.put("groupId", getGroupId());
214 attributes.put("companyId", getCompanyId());
215 attributes.put("userId", getUserId());
216 attributes.put("userName", getUserName());
217 attributes.put("createDate", getCreateDate());
218 attributes.put("modifiedDate", getModifiedDate());
219 attributes.put("classNameId", getClassNameId());
220 attributes.put("structureKey", getStructureKey());
221 attributes.put("name", getName());
222 attributes.put("description", getDescription());
223 attributes.put("xsd", getXsd());
224 attributes.put("storageType", getStorageType());
225 attributes.put("type", getType());
226
227 return attributes;
228 }
229
230 @Override
231 public void setModelAttributes(Map<String, Object> attributes) {
232 String uuid = (String)attributes.get("uuid");
233
234 if (uuid != null) {
235 setUuid(uuid);
236 }
237
238 Long structureId = (Long)attributes.get("structureId");
239
240 if (structureId != null) {
241 setStructureId(structureId);
242 }
243
244 Long groupId = (Long)attributes.get("groupId");
245
246 if (groupId != null) {
247 setGroupId(groupId);
248 }
249
250 Long companyId = (Long)attributes.get("companyId");
251
252 if (companyId != null) {
253 setCompanyId(companyId);
254 }
255
256 Long userId = (Long)attributes.get("userId");
257
258 if (userId != null) {
259 setUserId(userId);
260 }
261
262 String userName = (String)attributes.get("userName");
263
264 if (userName != null) {
265 setUserName(userName);
266 }
267
268 Date createDate = (Date)attributes.get("createDate");
269
270 if (createDate != null) {
271 setCreateDate(createDate);
272 }
273
274 Date modifiedDate = (Date)attributes.get("modifiedDate");
275
276 if (modifiedDate != null) {
277 setModifiedDate(modifiedDate);
278 }
279
280 Long classNameId = (Long)attributes.get("classNameId");
281
282 if (classNameId != null) {
283 setClassNameId(classNameId);
284 }
285
286 String structureKey = (String)attributes.get("structureKey");
287
288 if (structureKey != null) {
289 setStructureKey(structureKey);
290 }
291
292 String name = (String)attributes.get("name");
293
294 if (name != null) {
295 setName(name);
296 }
297
298 String description = (String)attributes.get("description");
299
300 if (description != null) {
301 setDescription(description);
302 }
303
304 String xsd = (String)attributes.get("xsd");
305
306 if (xsd != null) {
307 setXsd(xsd);
308 }
309
310 String storageType = (String)attributes.get("storageType");
311
312 if (storageType != null) {
313 setStorageType(storageType);
314 }
315
316 Integer type = (Integer)attributes.get("type");
317
318 if (type != null) {
319 setType(type);
320 }
321 }
322
323 @JSON
324 public String getUuid() {
325 if (_uuid == null) {
326 return StringPool.BLANK;
327 }
328 else {
329 return _uuid;
330 }
331 }
332
333 public void setUuid(String uuid) {
334 if (_originalUuid == null) {
335 _originalUuid = _uuid;
336 }
337
338 _uuid = uuid;
339 }
340
341 public String getOriginalUuid() {
342 return GetterUtil.getString(_originalUuid);
343 }
344
345 @JSON
346 public long getStructureId() {
347 return _structureId;
348 }
349
350 public void setStructureId(long structureId) {
351 _structureId = structureId;
352 }
353
354 @JSON
355 public long getGroupId() {
356 return _groupId;
357 }
358
359 public void setGroupId(long groupId) {
360 _columnBitmask |= GROUPID_COLUMN_BITMASK;
361
362 if (!_setOriginalGroupId) {
363 _setOriginalGroupId = true;
364
365 _originalGroupId = _groupId;
366 }
367
368 _groupId = groupId;
369 }
370
371 public long getOriginalGroupId() {
372 return _originalGroupId;
373 }
374
375 @JSON
376 public long getCompanyId() {
377 return _companyId;
378 }
379
380 public void setCompanyId(long companyId) {
381 _columnBitmask |= COMPANYID_COLUMN_BITMASK;
382
383 if (!_setOriginalCompanyId) {
384 _setOriginalCompanyId = true;
385
386 _originalCompanyId = _companyId;
387 }
388
389 _companyId = companyId;
390 }
391
392 public long getOriginalCompanyId() {
393 return _originalCompanyId;
394 }
395
396 @JSON
397 public long getUserId() {
398 return _userId;
399 }
400
401 public void setUserId(long userId) {
402 _userId = userId;
403 }
404
405 public String getUserUuid() throws SystemException {
406 return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
407 }
408
409 public void setUserUuid(String userUuid) {
410 _userUuid = userUuid;
411 }
412
413 @JSON
414 public String getUserName() {
415 if (_userName == null) {
416 return StringPool.BLANK;
417 }
418 else {
419 return _userName;
420 }
421 }
422
423 public void setUserName(String userName) {
424 _userName = userName;
425 }
426
427 @JSON
428 public Date getCreateDate() {
429 return _createDate;
430 }
431
432 public void setCreateDate(Date createDate) {
433 _createDate = createDate;
434 }
435
436 @JSON
437 public Date getModifiedDate() {
438 return _modifiedDate;
439 }
440
441 public void setModifiedDate(Date modifiedDate) {
442 _modifiedDate = modifiedDate;
443 }
444
445 public String getClassName() {
446 if (getClassNameId() <= 0) {
447 return StringPool.BLANK;
448 }
449
450 return PortalUtil.getClassName(getClassNameId());
451 }
452
453 public void setClassName(String className) {
454 long classNameId = 0;
455
456 if (Validator.isNotNull(className)) {
457 classNameId = PortalUtil.getClassNameId(className);
458 }
459
460 setClassNameId(classNameId);
461 }
462
463 @JSON
464 public long getClassNameId() {
465 return _classNameId;
466 }
467
468 public void setClassNameId(long classNameId) {
469 _columnBitmask |= CLASSNAMEID_COLUMN_BITMASK;
470
471 if (!_setOriginalClassNameId) {
472 _setOriginalClassNameId = true;
473
474 _originalClassNameId = _classNameId;
475 }
476
477 _classNameId = classNameId;
478 }
479
480 public long getOriginalClassNameId() {
481 return _originalClassNameId;
482 }
483
484 @JSON
485 public String getStructureKey() {
486 if (_structureKey == null) {
487 return StringPool.BLANK;
488 }
489 else {
490 return _structureKey;
491 }
492 }
493
494 public void setStructureKey(String structureKey) {
495 _columnBitmask |= STRUCTUREKEY_COLUMN_BITMASK;
496
497 if (_originalStructureKey == null) {
498 _originalStructureKey = _structureKey;
499 }
500
501 _structureKey = structureKey;
502 }
503
504 public String getOriginalStructureKey() {
505 return GetterUtil.getString(_originalStructureKey);
506 }
507
508 @JSON
509 public String getName() {
510 if (_name == null) {
511 return StringPool.BLANK;
512 }
513 else {
514 return _name;
515 }
516 }
517
518 public String getName(Locale locale) {
519 String languageId = LocaleUtil.toLanguageId(locale);
520
521 return getName(languageId);
522 }
523
524 public String getName(Locale locale, boolean useDefault) {
525 String languageId = LocaleUtil.toLanguageId(locale);
526
527 return getName(languageId, useDefault);
528 }
529
530 public String getName(String languageId) {
531 return LocalizationUtil.getLocalization(getName(), languageId);
532 }
533
534 public String getName(String languageId, boolean useDefault) {
535 return LocalizationUtil.getLocalization(getName(), languageId,
536 useDefault);
537 }
538
539 public String getNameCurrentLanguageId() {
540 return _nameCurrentLanguageId;
541 }
542
543 @JSON
544 public String getNameCurrentValue() {
545 Locale locale = getLocale(_nameCurrentLanguageId);
546
547 return getName(locale);
548 }
549
550 public Map<Locale, String> getNameMap() {
551 return LocalizationUtil.getLocalizationMap(getName());
552 }
553
554 public void setName(String name) {
555 _columnBitmask |= NAME_COLUMN_BITMASK;
556
557 if (_originalName == null) {
558 _originalName = _name;
559 }
560
561 _name = name;
562 }
563
564 public void setName(String name, Locale locale) {
565 setName(name, locale, LocaleUtil.getDefault());
566 }
567
568 public void setName(String name, Locale locale, Locale defaultLocale) {
569 String languageId = LocaleUtil.toLanguageId(locale);
570 String defaultLanguageId = LocaleUtil.toLanguageId(defaultLocale);
571
572 if (Validator.isNotNull(name)) {
573 setName(LocalizationUtil.updateLocalization(getName(), "Name",
574 name, languageId, defaultLanguageId));
575 }
576 else {
577 setName(LocalizationUtil.removeLocalization(getName(), "Name",
578 languageId));
579 }
580 }
581
582 public void setNameCurrentLanguageId(String languageId) {
583 _nameCurrentLanguageId = languageId;
584 }
585
586 public void setNameMap(Map<Locale, String> nameMap) {
587 setNameMap(nameMap, LocaleUtil.getDefault());
588 }
589
590 public void setNameMap(Map<Locale, String> nameMap, Locale defaultLocale) {
591 if (nameMap == null) {
592 return;
593 }
594
595 Locale[] locales = LanguageUtil.getAvailableLocales();
596
597 for (Locale locale : locales) {
598 String name = nameMap.get(locale);
599
600 setName(name, locale, defaultLocale);
601 }
602 }
603
604 public String getOriginalName() {
605 return GetterUtil.getString(_originalName);
606 }
607
608 @JSON
609 public String getDescription() {
610 if (_description == null) {
611 return StringPool.BLANK;
612 }
613 else {
614 return _description;
615 }
616 }
617
618 public String getDescription(Locale locale) {
619 String languageId = LocaleUtil.toLanguageId(locale);
620
621 return getDescription(languageId);
622 }
623
624 public String getDescription(Locale locale, boolean useDefault) {
625 String languageId = LocaleUtil.toLanguageId(locale);
626
627 return getDescription(languageId, useDefault);
628 }
629
630 public String getDescription(String languageId) {
631 return LocalizationUtil.getLocalization(getDescription(), languageId);
632 }
633
634 public String getDescription(String languageId, boolean useDefault) {
635 return LocalizationUtil.getLocalization(getDescription(), languageId,
636 useDefault);
637 }
638
639 public String getDescriptionCurrentLanguageId() {
640 return _descriptionCurrentLanguageId;
641 }
642
643 @JSON
644 public String getDescriptionCurrentValue() {
645 Locale locale = getLocale(_descriptionCurrentLanguageId);
646
647 return getDescription(locale);
648 }
649
650 public Map<Locale, String> getDescriptionMap() {
651 return LocalizationUtil.getLocalizationMap(getDescription());
652 }
653
654 public void setDescription(String description) {
655 _columnBitmask |= DESCRIPTION_COLUMN_BITMASK;
656
657 if (_originalDescription == null) {
658 _originalDescription = _description;
659 }
660
661 _description = description;
662 }
663
664 public void setDescription(String description, Locale locale) {
665 setDescription(description, locale, LocaleUtil.getDefault());
666 }
667
668 public void setDescription(String description, Locale locale,
669 Locale defaultLocale) {
670 String languageId = LocaleUtil.toLanguageId(locale);
671 String defaultLanguageId = LocaleUtil.toLanguageId(defaultLocale);
672
673 if (Validator.isNotNull(description)) {
674 setDescription(LocalizationUtil.updateLocalization(
675 getDescription(), "Description", description, languageId,
676 defaultLanguageId));
677 }
678 else {
679 setDescription(LocalizationUtil.removeLocalization(
680 getDescription(), "Description", languageId));
681 }
682 }
683
684 public void setDescriptionCurrentLanguageId(String languageId) {
685 _descriptionCurrentLanguageId = languageId;
686 }
687
688 public void setDescriptionMap(Map<Locale, String> descriptionMap) {
689 setDescriptionMap(descriptionMap, LocaleUtil.getDefault());
690 }
691
692 public void setDescriptionMap(Map<Locale, String> descriptionMap,
693 Locale defaultLocale) {
694 if (descriptionMap == null) {
695 return;
696 }
697
698 Locale[] locales = LanguageUtil.getAvailableLocales();
699
700 for (Locale locale : locales) {
701 String description = descriptionMap.get(locale);
702
703 setDescription(description, locale, defaultLocale);
704 }
705 }
706
707 public String getOriginalDescription() {
708 return GetterUtil.getString(_originalDescription);
709 }
710
711 @JSON
712 public String getXsd() {
713 if (_xsd == null) {
714 return StringPool.BLANK;
715 }
716 else {
717 return _xsd;
718 }
719 }
720
721 public void setXsd(String xsd) {
722 _xsd = xsd;
723 }
724
725 @JSON
726 public String getStorageType() {
727 if (_storageType == null) {
728 return StringPool.BLANK;
729 }
730 else {
731 return _storageType;
732 }
733 }
734
735 public void setStorageType(String storageType) {
736 _storageType = storageType;
737 }
738
739 @JSON
740 public int getType() {
741 return _type;
742 }
743
744 public void setType(int type) {
745 _type = type;
746 }
747
748 public com.liferay.portal.kernel.xml.Document getDocument() {
749 return null;
750 }
751
752 public void setDocument(com.liferay.portal.kernel.xml.Document document) {
753 }
754
755 public java.util.Map<java.lang.String, java.util.Map<java.lang.String, java.util.Map<java.lang.String, java.lang.String>>> getLocalizedFieldsMap() {
756 return null;
757 }
758
759 public void setLocalizedFieldsMap(
760 java.util.Map<java.lang.String, java.util.Map<java.lang.String, java.util.Map<java.lang.String, java.lang.String>>> localizedFieldsMap) {
761 }
762
763 public java.util.Map<java.lang.String, java.util.Map<java.lang.String, java.util.Map<java.lang.String, java.lang.String>>> getLocalizedTransientFieldsMap() {
764 return null;
765 }
766
767 public void setLocalizedTransientFieldsMap(
768 java.util.Map<java.lang.String, java.util.Map<java.lang.String, java.util.Map<java.lang.String, java.lang.String>>> localizedTransientFieldsMap) {
769 }
770
771 public long getColumnBitmask() {
772 return _columnBitmask;
773 }
774
775 @Override
776 public ExpandoBridge getExpandoBridge() {
777 return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
778 DDMStructure.class.getName(), getPrimaryKey());
779 }
780
781 @Override
782 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
783 ExpandoBridge expandoBridge = getExpandoBridge();
784
785 expandoBridge.setAttributes(serviceContext);
786 }
787
788 @SuppressWarnings("unused")
789 public void prepareLocalizedFieldsForImport(Locale defaultImportLocale)
790 throws LocaleException {
791 setName(getName(defaultImportLocale), defaultImportLocale,
792 defaultImportLocale);
793 setDescription(getDescription(defaultImportLocale),
794 defaultImportLocale, defaultImportLocale);
795 }
796
797 @Override
798 public DDMStructure toEscapedModel() {
799 if (_escapedModel == null) {
800 _escapedModel = (DDMStructure)ProxyUtil.newProxyInstance(_classLoader,
801 _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
802 }
803
804 return _escapedModel;
805 }
806
807 public DDMStructure toUnescapedModel() {
808 return (DDMStructure)this;
809 }
810
811 @Override
812 public Object clone() {
813 DDMStructureImpl ddmStructureImpl = new DDMStructureImpl();
814
815 ddmStructureImpl.setUuid(getUuid());
816 ddmStructureImpl.setStructureId(getStructureId());
817 ddmStructureImpl.setGroupId(getGroupId());
818 ddmStructureImpl.setCompanyId(getCompanyId());
819 ddmStructureImpl.setUserId(getUserId());
820 ddmStructureImpl.setUserName(getUserName());
821 ddmStructureImpl.setCreateDate(getCreateDate());
822 ddmStructureImpl.setModifiedDate(getModifiedDate());
823 ddmStructureImpl.setClassNameId(getClassNameId());
824 ddmStructureImpl.setStructureKey(getStructureKey());
825 ddmStructureImpl.setName(getName());
826 ddmStructureImpl.setDescription(getDescription());
827 ddmStructureImpl.setXsd(getXsd());
828 ddmStructureImpl.setStorageType(getStorageType());
829 ddmStructureImpl.setType(getType());
830
831 ddmStructureImpl.resetOriginalValues();
832
833 return ddmStructureImpl;
834 }
835
836 public int compareTo(DDMStructure ddmStructure) {
837 long primaryKey = ddmStructure.getPrimaryKey();
838
839 if (getPrimaryKey() < primaryKey) {
840 return -1;
841 }
842 else if (getPrimaryKey() > primaryKey) {
843 return 1;
844 }
845 else {
846 return 0;
847 }
848 }
849
850 @Override
851 public boolean equals(Object obj) {
852 if (this == obj) {
853 return true;
854 }
855
856 if (!(obj instanceof DDMStructure)) {
857 return false;
858 }
859
860 DDMStructure ddmStructure = (DDMStructure)obj;
861
862 long primaryKey = ddmStructure.getPrimaryKey();
863
864 if (getPrimaryKey() == primaryKey) {
865 return true;
866 }
867 else {
868 return false;
869 }
870 }
871
872 @Override
873 public int hashCode() {
874 return (int)getPrimaryKey();
875 }
876
877 @Override
878 public void resetOriginalValues() {
879 DDMStructureModelImpl ddmStructureModelImpl = this;
880
881 ddmStructureModelImpl._originalUuid = ddmStructureModelImpl._uuid;
882
883 ddmStructureModelImpl._originalGroupId = ddmStructureModelImpl._groupId;
884
885 ddmStructureModelImpl._setOriginalGroupId = false;
886
887 ddmStructureModelImpl._originalCompanyId = ddmStructureModelImpl._companyId;
888
889 ddmStructureModelImpl._setOriginalCompanyId = false;
890
891 ddmStructureModelImpl._originalClassNameId = ddmStructureModelImpl._classNameId;
892
893 ddmStructureModelImpl._setOriginalClassNameId = false;
894
895 ddmStructureModelImpl._originalStructureKey = ddmStructureModelImpl._structureKey;
896
897 ddmStructureModelImpl._originalName = ddmStructureModelImpl._name;
898
899 ddmStructureModelImpl._originalDescription = ddmStructureModelImpl._description;
900
901 ddmStructureModelImpl._columnBitmask = 0;
902 }
903
904 @Override
905 public CacheModel<DDMStructure> toCacheModel() {
906 DDMStructureCacheModel ddmStructureCacheModel = new DDMStructureCacheModel();
907
908 ddmStructureCacheModel.uuid = getUuid();
909
910 String uuid = ddmStructureCacheModel.uuid;
911
912 if ((uuid != null) && (uuid.length() == 0)) {
913 ddmStructureCacheModel.uuid = null;
914 }
915
916 ddmStructureCacheModel.structureId = getStructureId();
917
918 ddmStructureCacheModel.groupId = getGroupId();
919
920 ddmStructureCacheModel.companyId = getCompanyId();
921
922 ddmStructureCacheModel.userId = getUserId();
923
924 ddmStructureCacheModel.userName = getUserName();
925
926 String userName = ddmStructureCacheModel.userName;
927
928 if ((userName != null) && (userName.length() == 0)) {
929 ddmStructureCacheModel.userName = null;
930 }
931
932 Date createDate = getCreateDate();
933
934 if (createDate != null) {
935 ddmStructureCacheModel.createDate = createDate.getTime();
936 }
937 else {
938 ddmStructureCacheModel.createDate = Long.MIN_VALUE;
939 }
940
941 Date modifiedDate = getModifiedDate();
942
943 if (modifiedDate != null) {
944 ddmStructureCacheModel.modifiedDate = modifiedDate.getTime();
945 }
946 else {
947 ddmStructureCacheModel.modifiedDate = Long.MIN_VALUE;
948 }
949
950 ddmStructureCacheModel.classNameId = getClassNameId();
951
952 ddmStructureCacheModel.structureKey = getStructureKey();
953
954 String structureKey = ddmStructureCacheModel.structureKey;
955
956 if ((structureKey != null) && (structureKey.length() == 0)) {
957 ddmStructureCacheModel.structureKey = null;
958 }
959
960 ddmStructureCacheModel.name = getName();
961
962 String name = ddmStructureCacheModel.name;
963
964 if ((name != null) && (name.length() == 0)) {
965 ddmStructureCacheModel.name = null;
966 }
967
968 ddmStructureCacheModel.description = getDescription();
969
970 String description = ddmStructureCacheModel.description;
971
972 if ((description != null) && (description.length() == 0)) {
973 ddmStructureCacheModel.description = null;
974 }
975
976 ddmStructureCacheModel.xsd = getXsd();
977
978 String xsd = ddmStructureCacheModel.xsd;
979
980 if ((xsd != null) && (xsd.length() == 0)) {
981 ddmStructureCacheModel.xsd = null;
982 }
983
984 ddmStructureCacheModel.storageType = getStorageType();
985
986 String storageType = ddmStructureCacheModel.storageType;
987
988 if ((storageType != null) && (storageType.length() == 0)) {
989 ddmStructureCacheModel.storageType = null;
990 }
991
992 ddmStructureCacheModel.type = getType();
993
994 ddmStructureCacheModel._document = getDocument();
995
996 ddmStructureCacheModel._localizedFieldsMap = getLocalizedFieldsMap();
997
998 ddmStructureCacheModel._localizedTransientFieldsMap = getLocalizedTransientFieldsMap();
999
1000 return ddmStructureCacheModel;
1001 }
1002
1003 @Override
1004 public String toString() {
1005 StringBundler sb = new StringBundler(31);
1006
1007 sb.append("{uuid=");
1008 sb.append(getUuid());
1009 sb.append(", structureId=");
1010 sb.append(getStructureId());
1011 sb.append(", groupId=");
1012 sb.append(getGroupId());
1013 sb.append(", companyId=");
1014 sb.append(getCompanyId());
1015 sb.append(", userId=");
1016 sb.append(getUserId());
1017 sb.append(", userName=");
1018 sb.append(getUserName());
1019 sb.append(", createDate=");
1020 sb.append(getCreateDate());
1021 sb.append(", modifiedDate=");
1022 sb.append(getModifiedDate());
1023 sb.append(", classNameId=");
1024 sb.append(getClassNameId());
1025 sb.append(", structureKey=");
1026 sb.append(getStructureKey());
1027 sb.append(", name=");
1028 sb.append(getName());
1029 sb.append(", description=");
1030 sb.append(getDescription());
1031 sb.append(", xsd=");
1032 sb.append(getXsd());
1033 sb.append(", storageType=");
1034 sb.append(getStorageType());
1035 sb.append(", type=");
1036 sb.append(getType());
1037 sb.append("}");
1038
1039 return sb.toString();
1040 }
1041
1042 public String toXmlString() {
1043 StringBundler sb = new StringBundler(49);
1044
1045 sb.append("<model><model-name>");
1046 sb.append("com.liferay.portlet.dynamicdatamapping.model.DDMStructure");
1047 sb.append("</model-name>");
1048
1049 sb.append(
1050 "<column><column-name>uuid</column-name><column-value><![CDATA[");
1051 sb.append(getUuid());
1052 sb.append("]]></column-value></column>");
1053 sb.append(
1054 "<column><column-name>structureId</column-name><column-value><![CDATA[");
1055 sb.append(getStructureId());
1056 sb.append("]]></column-value></column>");
1057 sb.append(
1058 "<column><column-name>groupId</column-name><column-value><![CDATA[");
1059 sb.append(getGroupId());
1060 sb.append("]]></column-value></column>");
1061 sb.append(
1062 "<column><column-name>companyId</column-name><column-value><![CDATA[");
1063 sb.append(getCompanyId());
1064 sb.append("]]></column-value></column>");
1065 sb.append(
1066 "<column><column-name>userId</column-name><column-value><![CDATA[");
1067 sb.append(getUserId());
1068 sb.append("]]></column-value></column>");
1069 sb.append(
1070 "<column><column-name>userName</column-name><column-value><![CDATA[");
1071 sb.append(getUserName());
1072 sb.append("]]></column-value></column>");
1073 sb.append(
1074 "<column><column-name>createDate</column-name><column-value><![CDATA[");
1075 sb.append(getCreateDate());
1076 sb.append("]]></column-value></column>");
1077 sb.append(
1078 "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
1079 sb.append(getModifiedDate());
1080 sb.append("]]></column-value></column>");
1081 sb.append(
1082 "<column><column-name>classNameId</column-name><column-value><![CDATA[");
1083 sb.append(getClassNameId());
1084 sb.append("]]></column-value></column>");
1085 sb.append(
1086 "<column><column-name>structureKey</column-name><column-value><![CDATA[");
1087 sb.append(getStructureKey());
1088 sb.append("]]></column-value></column>");
1089 sb.append(
1090 "<column><column-name>name</column-name><column-value><![CDATA[");
1091 sb.append(getName());
1092 sb.append("]]></column-value></column>");
1093 sb.append(
1094 "<column><column-name>description</column-name><column-value><![CDATA[");
1095 sb.append(getDescription());
1096 sb.append("]]></column-value></column>");
1097 sb.append(
1098 "<column><column-name>xsd</column-name><column-value><![CDATA[");
1099 sb.append(getXsd());
1100 sb.append("]]></column-value></column>");
1101 sb.append(
1102 "<column><column-name>storageType</column-name><column-value><![CDATA[");
1103 sb.append(getStorageType());
1104 sb.append("]]></column-value></column>");
1105 sb.append(
1106 "<column><column-name>type</column-name><column-value><![CDATA[");
1107 sb.append(getType());
1108 sb.append("]]></column-value></column>");
1109
1110 sb.append("</model>");
1111
1112 return sb.toString();
1113 }
1114
1115 private static ClassLoader _classLoader = DDMStructure.class.getClassLoader();
1116 private static Class<?>[] _escapedModelInterfaces = new Class[] {
1117 DDMStructure.class
1118 };
1119 private String _uuid;
1120 private String _originalUuid;
1121 private long _structureId;
1122 private long _groupId;
1123 private long _originalGroupId;
1124 private boolean _setOriginalGroupId;
1125 private long _companyId;
1126 private long _originalCompanyId;
1127 private boolean _setOriginalCompanyId;
1128 private long _userId;
1129 private String _userUuid;
1130 private String _userName;
1131 private Date _createDate;
1132 private Date _modifiedDate;
1133 private long _classNameId;
1134 private long _originalClassNameId;
1135 private boolean _setOriginalClassNameId;
1136 private String _structureKey;
1137 private String _originalStructureKey;
1138 private String _name;
1139 private String _nameCurrentLanguageId;
1140 private String _originalName;
1141 private String _description;
1142 private String _descriptionCurrentLanguageId;
1143 private String _originalDescription;
1144 private String _xsd;
1145 private String _storageType;
1146 private int _type;
1147 private long _columnBitmask;
1148 private DDMStructure _escapedModel;
1149 }