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