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