001    /**
002     * Copyright (c) 2000-2013 Liferay, Inc. All rights reserved.
003     *
004     * This library is free software; you can redistribute it and/or modify it under
005     * the terms of the GNU Lesser General Public License as published by the Free
006     * Software Foundation; either version 2.1 of the License, or (at your option)
007     * any later version.
008     *
009     * This library is distributed in the hope that it will be useful, but WITHOUT
010     * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
011     * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
012     * details.
013     */
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.language.LanguageUtil;
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    
051    /**
052     * The base model implementation for the AssetCategory service. Represents a row in the "AssetCategory" database table, with each column mapped to a property of this class.
053     *
054     * <p>
055     * This implementation and its corresponding interface {@link com.liferay.portlet.asset.model.AssetCategoryModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link AssetCategoryImpl}.
056     * </p>
057     *
058     * @author Brian Wing Shun Chan
059     * @see AssetCategoryImpl
060     * @see com.liferay.portlet.asset.model.AssetCategory
061     * @see com.liferay.portlet.asset.model.AssetCategoryModel
062     * @generated
063     */
064    @JSON(strict = true)
065    public class AssetCategoryModelImpl extends BaseModelImpl<AssetCategory>
066            implements AssetCategoryModel {
067            /*
068             * NOTE FOR DEVELOPERS:
069             *
070             * Never modify or reference this class directly. All methods that expect a asset category model instance should use the {@link com.liferay.portlet.asset.model.AssetCategory} interface instead.
071             */
072            public static final String TABLE_NAME = "AssetCategory";
073            public static final Object[][] TABLE_COLUMNS = {
074                            { "uuid_", Types.VARCHAR },
075                            { "categoryId", Types.BIGINT },
076                            { "groupId", Types.BIGINT },
077                            { "companyId", Types.BIGINT },
078                            { "userId", Types.BIGINT },
079                            { "userName", Types.VARCHAR },
080                            { "createDate", Types.TIMESTAMP },
081                            { "modifiedDate", Types.TIMESTAMP },
082                            { "parentCategoryId", Types.BIGINT },
083                            { "leftCategoryId", Types.BIGINT },
084                            { "rightCategoryId", Types.BIGINT },
085                            { "name", Types.VARCHAR },
086                            { "title", Types.VARCHAR },
087                            { "description", Types.VARCHAR },
088                            { "vocabularyId", Types.BIGINT }
089                    };
090            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)";
091            public static final String TABLE_SQL_DROP = "drop table AssetCategory";
092            public static final String ORDER_BY_JPQL = " ORDER BY assetCategory.name ASC";
093            public static final String ORDER_BY_SQL = " ORDER BY AssetCategory.name ASC";
094            public static final String DATA_SOURCE = "liferayDataSource";
095            public static final String SESSION_FACTORY = "liferaySessionFactory";
096            public static final String TX_MANAGER = "liferayTransactionManager";
097            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
098                                    "value.object.entity.cache.enabled.com.liferay.portlet.asset.model.AssetCategory"),
099                            true);
100            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
101                                    "value.object.finder.cache.enabled.com.liferay.portlet.asset.model.AssetCategory"),
102                            true);
103            public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
104                                    "value.object.column.bitmask.enabled.com.liferay.portlet.asset.model.AssetCategory"),
105                            true);
106            public static long GROUPID_COLUMN_BITMASK = 1L;
107            public static long NAME_COLUMN_BITMASK = 2L;
108            public static long PARENTCATEGORYID_COLUMN_BITMASK = 4L;
109            public static long UUID_COLUMN_BITMASK = 8L;
110            public static long VOCABULARYID_COLUMN_BITMASK = 16L;
111    
112            /**
113             * Converts the soap model instance into a normal model instance.
114             *
115             * @param soapModel the soap model instance to convert
116             * @return the normal model instance
117             */
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            /**
145             * Converts the soap model instances into normal model instances.
146             *
147             * @param soapModels the soap model instances to convert
148             * @return the normal model instances
149             */
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 (categoryId LONG not null,entryId LONG not null,primary key (categoryId, entryId))";
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                    _companyId = companyId;
381            }
382    
383            @JSON
384            public long getUserId() {
385                    return _userId;
386            }
387    
388            public void setUserId(long userId) {
389                    _userId = userId;
390            }
391    
392            public String getUserUuid() throws SystemException {
393                    return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
394            }
395    
396            public void setUserUuid(String userUuid) {
397                    _userUuid = userUuid;
398            }
399    
400            @JSON
401            public String getUserName() {
402                    if (_userName == null) {
403                            return StringPool.BLANK;
404                    }
405                    else {
406                            return _userName;
407                    }
408            }
409    
410            public void setUserName(String userName) {
411                    _userName = userName;
412            }
413    
414            @JSON
415            public Date getCreateDate() {
416                    return _createDate;
417            }
418    
419            public void setCreateDate(Date createDate) {
420                    _createDate = createDate;
421            }
422    
423            @JSON
424            public Date getModifiedDate() {
425                    return _modifiedDate;
426            }
427    
428            public void setModifiedDate(Date modifiedDate) {
429                    _modifiedDate = modifiedDate;
430            }
431    
432            @JSON
433            public long getParentCategoryId() {
434                    return _parentCategoryId;
435            }
436    
437            public void setParentCategoryId(long parentCategoryId) {
438                    _columnBitmask |= PARENTCATEGORYID_COLUMN_BITMASK;
439    
440                    if (!_setOriginalParentCategoryId) {
441                            _setOriginalParentCategoryId = true;
442    
443                            _originalParentCategoryId = _parentCategoryId;
444                    }
445    
446                    _parentCategoryId = parentCategoryId;
447            }
448    
449            public long getOriginalParentCategoryId() {
450                    return _originalParentCategoryId;
451            }
452    
453            @JSON
454            public long getLeftCategoryId() {
455                    return _leftCategoryId;
456            }
457    
458            public void setLeftCategoryId(long leftCategoryId) {
459                    _leftCategoryId = leftCategoryId;
460            }
461    
462            @JSON
463            public long getRightCategoryId() {
464                    return _rightCategoryId;
465            }
466    
467            public void setRightCategoryId(long rightCategoryId) {
468                    _rightCategoryId = rightCategoryId;
469            }
470    
471            @JSON
472            public String getName() {
473                    if (_name == null) {
474                            return StringPool.BLANK;
475                    }
476                    else {
477                            return _name;
478                    }
479            }
480    
481            public void setName(String name) {
482                    _columnBitmask = -1L;
483    
484                    if (_originalName == null) {
485                            _originalName = _name;
486                    }
487    
488                    _name = name;
489            }
490    
491            public String getOriginalName() {
492                    return GetterUtil.getString(_originalName);
493            }
494    
495            @JSON
496            public String getTitle() {
497                    if (_title == null) {
498                            return StringPool.BLANK;
499                    }
500                    else {
501                            return _title;
502                    }
503            }
504    
505            public String getTitle(Locale locale) {
506                    String languageId = LocaleUtil.toLanguageId(locale);
507    
508                    return getTitle(languageId);
509            }
510    
511            public String getTitle(Locale locale, boolean useDefault) {
512                    String languageId = LocaleUtil.toLanguageId(locale);
513    
514                    return getTitle(languageId, useDefault);
515            }
516    
517            public String getTitle(String languageId) {
518                    return LocalizationUtil.getLocalization(getTitle(), languageId);
519            }
520    
521            public String getTitle(String languageId, boolean useDefault) {
522                    return LocalizationUtil.getLocalization(getTitle(), languageId,
523                            useDefault);
524            }
525    
526            public String getTitleCurrentLanguageId() {
527                    return _titleCurrentLanguageId;
528            }
529    
530            @JSON
531            public String getTitleCurrentValue() {
532                    Locale locale = getLocale(_titleCurrentLanguageId);
533    
534                    return getTitle(locale);
535            }
536    
537            public Map<Locale, String> getTitleMap() {
538                    return LocalizationUtil.getLocalizationMap(getTitle());
539            }
540    
541            public void setTitle(String title) {
542                    _title = title;
543            }
544    
545            public void setTitle(String title, Locale locale) {
546                    setTitle(title, locale, LocaleUtil.getDefault());
547            }
548    
549            public void setTitle(String title, Locale locale, Locale defaultLocale) {
550                    String languageId = LocaleUtil.toLanguageId(locale);
551                    String defaultLanguageId = LocaleUtil.toLanguageId(defaultLocale);
552    
553                    if (Validator.isNotNull(title)) {
554                            setTitle(LocalizationUtil.updateLocalization(getTitle(), "Title",
555                                            title, languageId, defaultLanguageId));
556                    }
557                    else {
558                            setTitle(LocalizationUtil.removeLocalization(getTitle(), "Title",
559                                            languageId));
560                    }
561            }
562    
563            public void setTitleCurrentLanguageId(String languageId) {
564                    _titleCurrentLanguageId = languageId;
565            }
566    
567            public void setTitleMap(Map<Locale, String> titleMap) {
568                    setTitleMap(titleMap, LocaleUtil.getDefault());
569            }
570    
571            public void setTitleMap(Map<Locale, String> titleMap, Locale defaultLocale) {
572                    if (titleMap == null) {
573                            return;
574                    }
575    
576                    Locale[] locales = LanguageUtil.getAvailableLocales();
577    
578                    for (Locale locale : locales) {
579                            String title = titleMap.get(locale);
580    
581                            setTitle(title, locale, defaultLocale);
582                    }
583            }
584    
585            @JSON
586            public String getDescription() {
587                    if (_description == null) {
588                            return StringPool.BLANK;
589                    }
590                    else {
591                            return _description;
592                    }
593            }
594    
595            public String getDescription(Locale locale) {
596                    String languageId = LocaleUtil.toLanguageId(locale);
597    
598                    return getDescription(languageId);
599            }
600    
601            public String getDescription(Locale locale, boolean useDefault) {
602                    String languageId = LocaleUtil.toLanguageId(locale);
603    
604                    return getDescription(languageId, useDefault);
605            }
606    
607            public String getDescription(String languageId) {
608                    return LocalizationUtil.getLocalization(getDescription(), languageId);
609            }
610    
611            public String getDescription(String languageId, boolean useDefault) {
612                    return LocalizationUtil.getLocalization(getDescription(), languageId,
613                            useDefault);
614            }
615    
616            public String getDescriptionCurrentLanguageId() {
617                    return _descriptionCurrentLanguageId;
618            }
619    
620            @JSON
621            public String getDescriptionCurrentValue() {
622                    Locale locale = getLocale(_descriptionCurrentLanguageId);
623    
624                    return getDescription(locale);
625            }
626    
627            public Map<Locale, String> getDescriptionMap() {
628                    return LocalizationUtil.getLocalizationMap(getDescription());
629            }
630    
631            public void setDescription(String description) {
632                    _description = description;
633            }
634    
635            public void setDescription(String description, Locale locale) {
636                    setDescription(description, locale, LocaleUtil.getDefault());
637            }
638    
639            public void setDescription(String description, Locale locale,
640                    Locale defaultLocale) {
641                    String languageId = LocaleUtil.toLanguageId(locale);
642                    String defaultLanguageId = LocaleUtil.toLanguageId(defaultLocale);
643    
644                    if (Validator.isNotNull(description)) {
645                            setDescription(LocalizationUtil.updateLocalization(
646                                            getDescription(), "Description", description, languageId,
647                                            defaultLanguageId));
648                    }
649                    else {
650                            setDescription(LocalizationUtil.removeLocalization(
651                                            getDescription(), "Description", languageId));
652                    }
653            }
654    
655            public void setDescriptionCurrentLanguageId(String languageId) {
656                    _descriptionCurrentLanguageId = languageId;
657            }
658    
659            public void setDescriptionMap(Map<Locale, String> descriptionMap) {
660                    setDescriptionMap(descriptionMap, LocaleUtil.getDefault());
661            }
662    
663            public void setDescriptionMap(Map<Locale, String> descriptionMap,
664                    Locale defaultLocale) {
665                    if (descriptionMap == null) {
666                            return;
667                    }
668    
669                    Locale[] locales = LanguageUtil.getAvailableLocales();
670    
671                    for (Locale locale : locales) {
672                            String description = descriptionMap.get(locale);
673    
674                            setDescription(description, locale, defaultLocale);
675                    }
676            }
677    
678            @JSON
679            public long getVocabularyId() {
680                    return _vocabularyId;
681            }
682    
683            public void setVocabularyId(long vocabularyId) {
684                    _columnBitmask |= VOCABULARYID_COLUMN_BITMASK;
685    
686                    if (!_setOriginalVocabularyId) {
687                            _setOriginalVocabularyId = true;
688    
689                            _originalVocabularyId = _vocabularyId;
690                    }
691    
692                    _vocabularyId = vocabularyId;
693            }
694    
695            public long getOriginalVocabularyId() {
696                    return _originalVocabularyId;
697            }
698    
699            public long getColumnBitmask() {
700                    return _columnBitmask;
701            }
702    
703            @Override
704            public ExpandoBridge getExpandoBridge() {
705                    return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
706                            AssetCategory.class.getName(), getPrimaryKey());
707            }
708    
709            @Override
710            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
711                    ExpandoBridge expandoBridge = getExpandoBridge();
712    
713                    expandoBridge.setAttributes(serviceContext);
714            }
715    
716            @SuppressWarnings("unused")
717            public void prepareLocalizedFieldsForImport(Locale defaultImportLocale)
718                    throws LocaleException {
719                    setTitle(getTitle(defaultImportLocale), defaultImportLocale,
720                            defaultImportLocale);
721                    setDescription(getDescription(defaultImportLocale),
722                            defaultImportLocale, defaultImportLocale);
723            }
724    
725            @Override
726            public AssetCategory toEscapedModel() {
727                    if (_escapedModel == null) {
728                            _escapedModel = (AssetCategory)ProxyUtil.newProxyInstance(_classLoader,
729                                            _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
730                    }
731    
732                    return _escapedModel;
733            }
734    
735            public AssetCategory toUnescapedModel() {
736                    return (AssetCategory)this;
737            }
738    
739            @Override
740            public Object clone() {
741                    AssetCategoryImpl assetCategoryImpl = new AssetCategoryImpl();
742    
743                    assetCategoryImpl.setUuid(getUuid());
744                    assetCategoryImpl.setCategoryId(getCategoryId());
745                    assetCategoryImpl.setGroupId(getGroupId());
746                    assetCategoryImpl.setCompanyId(getCompanyId());
747                    assetCategoryImpl.setUserId(getUserId());
748                    assetCategoryImpl.setUserName(getUserName());
749                    assetCategoryImpl.setCreateDate(getCreateDate());
750                    assetCategoryImpl.setModifiedDate(getModifiedDate());
751                    assetCategoryImpl.setParentCategoryId(getParentCategoryId());
752                    assetCategoryImpl.setLeftCategoryId(getLeftCategoryId());
753                    assetCategoryImpl.setRightCategoryId(getRightCategoryId());
754                    assetCategoryImpl.setName(getName());
755                    assetCategoryImpl.setTitle(getTitle());
756                    assetCategoryImpl.setDescription(getDescription());
757                    assetCategoryImpl.setVocabularyId(getVocabularyId());
758    
759                    assetCategoryImpl.resetOriginalValues();
760    
761                    return assetCategoryImpl;
762            }
763    
764            public int compareTo(AssetCategory assetCategory) {
765                    int value = 0;
766    
767                    value = getName().compareTo(assetCategory.getName());
768    
769                    if (value != 0) {
770                            return value;
771                    }
772    
773                    return 0;
774            }
775    
776            @Override
777            public boolean equals(Object obj) {
778                    if (this == obj) {
779                            return true;
780                    }
781    
782                    if (!(obj instanceof AssetCategory)) {
783                            return false;
784                    }
785    
786                    AssetCategory assetCategory = (AssetCategory)obj;
787    
788                    long primaryKey = assetCategory.getPrimaryKey();
789    
790                    if (getPrimaryKey() == primaryKey) {
791                            return true;
792                    }
793                    else {
794                            return false;
795                    }
796            }
797    
798            @Override
799            public int hashCode() {
800                    return (int)getPrimaryKey();
801            }
802    
803            @Override
804            public void resetOriginalValues() {
805                    AssetCategoryModelImpl assetCategoryModelImpl = this;
806    
807                    assetCategoryModelImpl._originalUuid = assetCategoryModelImpl._uuid;
808    
809                    assetCategoryModelImpl._originalGroupId = assetCategoryModelImpl._groupId;
810    
811                    assetCategoryModelImpl._setOriginalGroupId = false;
812    
813                    assetCategoryModelImpl._originalParentCategoryId = assetCategoryModelImpl._parentCategoryId;
814    
815                    assetCategoryModelImpl._setOriginalParentCategoryId = false;
816    
817                    assetCategoryModelImpl._originalName = assetCategoryModelImpl._name;
818    
819                    assetCategoryModelImpl._originalVocabularyId = assetCategoryModelImpl._vocabularyId;
820    
821                    assetCategoryModelImpl._setOriginalVocabularyId = false;
822    
823                    assetCategoryModelImpl._columnBitmask = 0;
824            }
825    
826            @Override
827            public CacheModel<AssetCategory> toCacheModel() {
828                    AssetCategoryCacheModel assetCategoryCacheModel = new AssetCategoryCacheModel();
829    
830                    assetCategoryCacheModel.uuid = getUuid();
831    
832                    String uuid = assetCategoryCacheModel.uuid;
833    
834                    if ((uuid != null) && (uuid.length() == 0)) {
835                            assetCategoryCacheModel.uuid = null;
836                    }
837    
838                    assetCategoryCacheModel.categoryId = getCategoryId();
839    
840                    assetCategoryCacheModel.groupId = getGroupId();
841    
842                    assetCategoryCacheModel.companyId = getCompanyId();
843    
844                    assetCategoryCacheModel.userId = getUserId();
845    
846                    assetCategoryCacheModel.userName = getUserName();
847    
848                    String userName = assetCategoryCacheModel.userName;
849    
850                    if ((userName != null) && (userName.length() == 0)) {
851                            assetCategoryCacheModel.userName = null;
852                    }
853    
854                    Date createDate = getCreateDate();
855    
856                    if (createDate != null) {
857                            assetCategoryCacheModel.createDate = createDate.getTime();
858                    }
859                    else {
860                            assetCategoryCacheModel.createDate = Long.MIN_VALUE;
861                    }
862    
863                    Date modifiedDate = getModifiedDate();
864    
865                    if (modifiedDate != null) {
866                            assetCategoryCacheModel.modifiedDate = modifiedDate.getTime();
867                    }
868                    else {
869                            assetCategoryCacheModel.modifiedDate = Long.MIN_VALUE;
870                    }
871    
872                    assetCategoryCacheModel.parentCategoryId = getParentCategoryId();
873    
874                    assetCategoryCacheModel.leftCategoryId = getLeftCategoryId();
875    
876                    assetCategoryCacheModel.rightCategoryId = getRightCategoryId();
877    
878                    assetCategoryCacheModel.name = getName();
879    
880                    String name = assetCategoryCacheModel.name;
881    
882                    if ((name != null) && (name.length() == 0)) {
883                            assetCategoryCacheModel.name = null;
884                    }
885    
886                    assetCategoryCacheModel.title = getTitle();
887    
888                    String title = assetCategoryCacheModel.title;
889    
890                    if ((title != null) && (title.length() == 0)) {
891                            assetCategoryCacheModel.title = null;
892                    }
893    
894                    assetCategoryCacheModel.description = getDescription();
895    
896                    String description = assetCategoryCacheModel.description;
897    
898                    if ((description != null) && (description.length() == 0)) {
899                            assetCategoryCacheModel.description = null;
900                    }
901    
902                    assetCategoryCacheModel.vocabularyId = getVocabularyId();
903    
904                    return assetCategoryCacheModel;
905            }
906    
907            @Override
908            public String toString() {
909                    StringBundler sb = new StringBundler(31);
910    
911                    sb.append("{uuid=");
912                    sb.append(getUuid());
913                    sb.append(", categoryId=");
914                    sb.append(getCategoryId());
915                    sb.append(", groupId=");
916                    sb.append(getGroupId());
917                    sb.append(", companyId=");
918                    sb.append(getCompanyId());
919                    sb.append(", userId=");
920                    sb.append(getUserId());
921                    sb.append(", userName=");
922                    sb.append(getUserName());
923                    sb.append(", createDate=");
924                    sb.append(getCreateDate());
925                    sb.append(", modifiedDate=");
926                    sb.append(getModifiedDate());
927                    sb.append(", parentCategoryId=");
928                    sb.append(getParentCategoryId());
929                    sb.append(", leftCategoryId=");
930                    sb.append(getLeftCategoryId());
931                    sb.append(", rightCategoryId=");
932                    sb.append(getRightCategoryId());
933                    sb.append(", name=");
934                    sb.append(getName());
935                    sb.append(", title=");
936                    sb.append(getTitle());
937                    sb.append(", description=");
938                    sb.append(getDescription());
939                    sb.append(", vocabularyId=");
940                    sb.append(getVocabularyId());
941                    sb.append("}");
942    
943                    return sb.toString();
944            }
945    
946            public String toXmlString() {
947                    StringBundler sb = new StringBundler(49);
948    
949                    sb.append("<model><model-name>");
950                    sb.append("com.liferay.portlet.asset.model.AssetCategory");
951                    sb.append("</model-name>");
952    
953                    sb.append(
954                            "<column><column-name>uuid</column-name><column-value><![CDATA[");
955                    sb.append(getUuid());
956                    sb.append("]]></column-value></column>");
957                    sb.append(
958                            "<column><column-name>categoryId</column-name><column-value><![CDATA[");
959                    sb.append(getCategoryId());
960                    sb.append("]]></column-value></column>");
961                    sb.append(
962                            "<column><column-name>groupId</column-name><column-value><![CDATA[");
963                    sb.append(getGroupId());
964                    sb.append("]]></column-value></column>");
965                    sb.append(
966                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
967                    sb.append(getCompanyId());
968                    sb.append("]]></column-value></column>");
969                    sb.append(
970                            "<column><column-name>userId</column-name><column-value><![CDATA[");
971                    sb.append(getUserId());
972                    sb.append("]]></column-value></column>");
973                    sb.append(
974                            "<column><column-name>userName</column-name><column-value><![CDATA[");
975                    sb.append(getUserName());
976                    sb.append("]]></column-value></column>");
977                    sb.append(
978                            "<column><column-name>createDate</column-name><column-value><![CDATA[");
979                    sb.append(getCreateDate());
980                    sb.append("]]></column-value></column>");
981                    sb.append(
982                            "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
983                    sb.append(getModifiedDate());
984                    sb.append("]]></column-value></column>");
985                    sb.append(
986                            "<column><column-name>parentCategoryId</column-name><column-value><![CDATA[");
987                    sb.append(getParentCategoryId());
988                    sb.append("]]></column-value></column>");
989                    sb.append(
990                            "<column><column-name>leftCategoryId</column-name><column-value><![CDATA[");
991                    sb.append(getLeftCategoryId());
992                    sb.append("]]></column-value></column>");
993                    sb.append(
994                            "<column><column-name>rightCategoryId</column-name><column-value><![CDATA[");
995                    sb.append(getRightCategoryId());
996                    sb.append("]]></column-value></column>");
997                    sb.append(
998                            "<column><column-name>name</column-name><column-value><![CDATA[");
999                    sb.append(getName());
1000                    sb.append("]]></column-value></column>");
1001                    sb.append(
1002                            "<column><column-name>title</column-name><column-value><![CDATA[");
1003                    sb.append(getTitle());
1004                    sb.append("]]></column-value></column>");
1005                    sb.append(
1006                            "<column><column-name>description</column-name><column-value><![CDATA[");
1007                    sb.append(getDescription());
1008                    sb.append("]]></column-value></column>");
1009                    sb.append(
1010                            "<column><column-name>vocabularyId</column-name><column-value><![CDATA[");
1011                    sb.append(getVocabularyId());
1012                    sb.append("]]></column-value></column>");
1013    
1014                    sb.append("</model>");
1015    
1016                    return sb.toString();
1017            }
1018    
1019            private static ClassLoader _classLoader = AssetCategory.class.getClassLoader();
1020            private static Class<?>[] _escapedModelInterfaces = new Class[] {
1021                            AssetCategory.class
1022                    };
1023            private String _uuid;
1024            private String _originalUuid;
1025            private long _categoryId;
1026            private long _groupId;
1027            private long _originalGroupId;
1028            private boolean _setOriginalGroupId;
1029            private long _companyId;
1030            private long _userId;
1031            private String _userUuid;
1032            private String _userName;
1033            private Date _createDate;
1034            private Date _modifiedDate;
1035            private long _parentCategoryId;
1036            private long _originalParentCategoryId;
1037            private boolean _setOriginalParentCategoryId;
1038            private long _leftCategoryId;
1039            private long _rightCategoryId;
1040            private String _name;
1041            private String _originalName;
1042            private String _title;
1043            private String _titleCurrentLanguageId;
1044            private String _description;
1045            private String _descriptionCurrentLanguageId;
1046            private long _vocabularyId;
1047            private long _originalVocabularyId;
1048            private boolean _setOriginalVocabularyId;
1049            private long _columnBitmask;
1050            private AssetCategory _escapedModel;
1051    }