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