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