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