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