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.mobiledevicerules.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.expando.model.ExpandoBridge;
035    import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
036    import com.liferay.portlet.mobiledevicerules.model.MDRRule;
037    import com.liferay.portlet.mobiledevicerules.model.MDRRuleModel;
038    import com.liferay.portlet.mobiledevicerules.model.MDRRuleSoap;
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 MDRRule service. Represents a row in the "MDRRule" 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.mobiledevicerules.model.MDRRuleModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link MDRRuleImpl}.
056     * </p>
057     *
058     * @author Edward C. Han
059     * @see MDRRuleImpl
060     * @see com.liferay.portlet.mobiledevicerules.model.MDRRule
061     * @see com.liferay.portlet.mobiledevicerules.model.MDRRuleModel
062     * @generated
063     */
064    @JSON(strict = true)
065    public class MDRRuleModelImpl extends BaseModelImpl<MDRRule>
066            implements MDRRuleModel {
067            /*
068             * NOTE FOR DEVELOPERS:
069             *
070             * Never modify or reference this class directly. All methods that expect a m d r rule model instance should use the {@link com.liferay.portlet.mobiledevicerules.model.MDRRule} interface instead.
071             */
072            public static final String TABLE_NAME = "MDRRule";
073            public static final Object[][] TABLE_COLUMNS = {
074                            { "uuid_", Types.VARCHAR },
075                            { "ruleId", 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                            { "ruleGroupId", Types.BIGINT },
083                            { "name", Types.VARCHAR },
084                            { "description", Types.VARCHAR },
085                            { "type_", Types.VARCHAR },
086                            { "typeSettings", Types.CLOB }
087                    };
088            public static final String TABLE_SQL_CREATE = "create table MDRRule (uuid_ VARCHAR(75) null,ruleId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,ruleGroupId LONG,name STRING null,description STRING null,type_ VARCHAR(255) null,typeSettings TEXT null)";
089            public static final String TABLE_SQL_DROP = "drop table MDRRule";
090            public static final String DATA_SOURCE = "liferayDataSource";
091            public static final String SESSION_FACTORY = "liferaySessionFactory";
092            public static final String TX_MANAGER = "liferayTransactionManager";
093            public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
094                                    "value.object.entity.cache.enabled.com.liferay.portlet.mobiledevicerules.model.MDRRule"),
095                            true);
096            public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
097                                    "value.object.finder.cache.enabled.com.liferay.portlet.mobiledevicerules.model.MDRRule"),
098                            true);
099            public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
100                                    "value.object.column.bitmask.enabled.com.liferay.portlet.mobiledevicerules.model.MDRRule"),
101                            true);
102            public static long GROUPID_COLUMN_BITMASK = 1L;
103            public static long RULEGROUPID_COLUMN_BITMASK = 2L;
104            public static long UUID_COLUMN_BITMASK = 4L;
105    
106            /**
107             * Converts the soap model instance into a normal model instance.
108             *
109             * @param soapModel the soap model instance to convert
110             * @return the normal model instance
111             */
112            public static MDRRule toModel(MDRRuleSoap soapModel) {
113                    if (soapModel == null) {
114                            return null;
115                    }
116    
117                    MDRRule model = new MDRRuleImpl();
118    
119                    model.setUuid(soapModel.getUuid());
120                    model.setRuleId(soapModel.getRuleId());
121                    model.setGroupId(soapModel.getGroupId());
122                    model.setCompanyId(soapModel.getCompanyId());
123                    model.setUserId(soapModel.getUserId());
124                    model.setUserName(soapModel.getUserName());
125                    model.setCreateDate(soapModel.getCreateDate());
126                    model.setModifiedDate(soapModel.getModifiedDate());
127                    model.setRuleGroupId(soapModel.getRuleGroupId());
128                    model.setName(soapModel.getName());
129                    model.setDescription(soapModel.getDescription());
130                    model.setType(soapModel.getType());
131                    model.setTypeSettings(soapModel.getTypeSettings());
132    
133                    return model;
134            }
135    
136            /**
137             * Converts the soap model instances into normal model instances.
138             *
139             * @param soapModels the soap model instances to convert
140             * @return the normal model instances
141             */
142            public static List<MDRRule> toModels(MDRRuleSoap[] soapModels) {
143                    if (soapModels == null) {
144                            return null;
145                    }
146    
147                    List<MDRRule> models = new ArrayList<MDRRule>(soapModels.length);
148    
149                    for (MDRRuleSoap soapModel : soapModels) {
150                            models.add(toModel(soapModel));
151                    }
152    
153                    return models;
154            }
155    
156            public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
157                                    "lock.expiration.time.com.liferay.portlet.mobiledevicerules.model.MDRRule"));
158    
159            public MDRRuleModelImpl() {
160            }
161    
162            public long getPrimaryKey() {
163                    return _ruleId;
164            }
165    
166            public void setPrimaryKey(long primaryKey) {
167                    setRuleId(primaryKey);
168            }
169    
170            public Serializable getPrimaryKeyObj() {
171                    return new Long(_ruleId);
172            }
173    
174            public void setPrimaryKeyObj(Serializable primaryKeyObj) {
175                    setPrimaryKey(((Long)primaryKeyObj).longValue());
176            }
177    
178            public Class<?> getModelClass() {
179                    return MDRRule.class;
180            }
181    
182            public String getModelClassName() {
183                    return MDRRule.class.getName();
184            }
185    
186            @Override
187            public Map<String, Object> getModelAttributes() {
188                    Map<String, Object> attributes = new HashMap<String, Object>();
189    
190                    attributes.put("uuid", getUuid());
191                    attributes.put("ruleId", getRuleId());
192                    attributes.put("groupId", getGroupId());
193                    attributes.put("companyId", getCompanyId());
194                    attributes.put("userId", getUserId());
195                    attributes.put("userName", getUserName());
196                    attributes.put("createDate", getCreateDate());
197                    attributes.put("modifiedDate", getModifiedDate());
198                    attributes.put("ruleGroupId", getRuleGroupId());
199                    attributes.put("name", getName());
200                    attributes.put("description", getDescription());
201                    attributes.put("type", getType());
202                    attributes.put("typeSettings", getTypeSettings());
203    
204                    return attributes;
205            }
206    
207            @Override
208            public void setModelAttributes(Map<String, Object> attributes) {
209                    String uuid = (String)attributes.get("uuid");
210    
211                    if (uuid != null) {
212                            setUuid(uuid);
213                    }
214    
215                    Long ruleId = (Long)attributes.get("ruleId");
216    
217                    if (ruleId != null) {
218                            setRuleId(ruleId);
219                    }
220    
221                    Long groupId = (Long)attributes.get("groupId");
222    
223                    if (groupId != null) {
224                            setGroupId(groupId);
225                    }
226    
227                    Long companyId = (Long)attributes.get("companyId");
228    
229                    if (companyId != null) {
230                            setCompanyId(companyId);
231                    }
232    
233                    Long userId = (Long)attributes.get("userId");
234    
235                    if (userId != null) {
236                            setUserId(userId);
237                    }
238    
239                    String userName = (String)attributes.get("userName");
240    
241                    if (userName != null) {
242                            setUserName(userName);
243                    }
244    
245                    Date createDate = (Date)attributes.get("createDate");
246    
247                    if (createDate != null) {
248                            setCreateDate(createDate);
249                    }
250    
251                    Date modifiedDate = (Date)attributes.get("modifiedDate");
252    
253                    if (modifiedDate != null) {
254                            setModifiedDate(modifiedDate);
255                    }
256    
257                    Long ruleGroupId = (Long)attributes.get("ruleGroupId");
258    
259                    if (ruleGroupId != null) {
260                            setRuleGroupId(ruleGroupId);
261                    }
262    
263                    String name = (String)attributes.get("name");
264    
265                    if (name != null) {
266                            setName(name);
267                    }
268    
269                    String description = (String)attributes.get("description");
270    
271                    if (description != null) {
272                            setDescription(description);
273                    }
274    
275                    String type = (String)attributes.get("type");
276    
277                    if (type != null) {
278                            setType(type);
279                    }
280    
281                    String typeSettings = (String)attributes.get("typeSettings");
282    
283                    if (typeSettings != null) {
284                            setTypeSettings(typeSettings);
285                    }
286            }
287    
288            @JSON
289            public String getUuid() {
290                    if (_uuid == null) {
291                            return StringPool.BLANK;
292                    }
293                    else {
294                            return _uuid;
295                    }
296            }
297    
298            public void setUuid(String uuid) {
299                    if (_originalUuid == null) {
300                            _originalUuid = _uuid;
301                    }
302    
303                    _uuid = uuid;
304            }
305    
306            public String getOriginalUuid() {
307                    return GetterUtil.getString(_originalUuid);
308            }
309    
310            @JSON
311            public long getRuleId() {
312                    return _ruleId;
313            }
314    
315            public void setRuleId(long ruleId) {
316                    _ruleId = ruleId;
317            }
318    
319            @JSON
320            public long getGroupId() {
321                    return _groupId;
322            }
323    
324            public void setGroupId(long groupId) {
325                    _columnBitmask |= GROUPID_COLUMN_BITMASK;
326    
327                    if (!_setOriginalGroupId) {
328                            _setOriginalGroupId = true;
329    
330                            _originalGroupId = _groupId;
331                    }
332    
333                    _groupId = groupId;
334            }
335    
336            public long getOriginalGroupId() {
337                    return _originalGroupId;
338            }
339    
340            @JSON
341            public long getCompanyId() {
342                    return _companyId;
343            }
344    
345            public void setCompanyId(long companyId) {
346                    _companyId = companyId;
347            }
348    
349            @JSON
350            public long getUserId() {
351                    return _userId;
352            }
353    
354            public void setUserId(long userId) {
355                    _userId = userId;
356            }
357    
358            public String getUserUuid() throws SystemException {
359                    return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
360            }
361    
362            public void setUserUuid(String userUuid) {
363                    _userUuid = userUuid;
364            }
365    
366            @JSON
367            public String getUserName() {
368                    if (_userName == null) {
369                            return StringPool.BLANK;
370                    }
371                    else {
372                            return _userName;
373                    }
374            }
375    
376            public void setUserName(String userName) {
377                    _userName = userName;
378            }
379    
380            @JSON
381            public Date getCreateDate() {
382                    return _createDate;
383            }
384    
385            public void setCreateDate(Date createDate) {
386                    _createDate = createDate;
387            }
388    
389            @JSON
390            public Date getModifiedDate() {
391                    return _modifiedDate;
392            }
393    
394            public void setModifiedDate(Date modifiedDate) {
395                    _modifiedDate = modifiedDate;
396            }
397    
398            @JSON
399            public long getRuleGroupId() {
400                    return _ruleGroupId;
401            }
402    
403            public void setRuleGroupId(long ruleGroupId) {
404                    _columnBitmask |= RULEGROUPID_COLUMN_BITMASK;
405    
406                    if (!_setOriginalRuleGroupId) {
407                            _setOriginalRuleGroupId = true;
408    
409                            _originalRuleGroupId = _ruleGroupId;
410                    }
411    
412                    _ruleGroupId = ruleGroupId;
413            }
414    
415            public long getOriginalRuleGroupId() {
416                    return _originalRuleGroupId;
417            }
418    
419            @JSON
420            public String getName() {
421                    if (_name == null) {
422                            return StringPool.BLANK;
423                    }
424                    else {
425                            return _name;
426                    }
427            }
428    
429            public String getName(Locale locale) {
430                    String languageId = LocaleUtil.toLanguageId(locale);
431    
432                    return getName(languageId);
433            }
434    
435            public String getName(Locale locale, boolean useDefault) {
436                    String languageId = LocaleUtil.toLanguageId(locale);
437    
438                    return getName(languageId, useDefault);
439            }
440    
441            public String getName(String languageId) {
442                    return LocalizationUtil.getLocalization(getName(), languageId);
443            }
444    
445            public String getName(String languageId, boolean useDefault) {
446                    return LocalizationUtil.getLocalization(getName(), languageId,
447                            useDefault);
448            }
449    
450            public String getNameCurrentLanguageId() {
451                    return _nameCurrentLanguageId;
452            }
453    
454            @JSON
455            public String getNameCurrentValue() {
456                    Locale locale = getLocale(_nameCurrentLanguageId);
457    
458                    return getName(locale);
459            }
460    
461            public Map<Locale, String> getNameMap() {
462                    return LocalizationUtil.getLocalizationMap(getName());
463            }
464    
465            public void setName(String name) {
466                    _name = name;
467            }
468    
469            public void setName(String name, Locale locale) {
470                    setName(name, locale, LocaleUtil.getDefault());
471            }
472    
473            public void setName(String name, Locale locale, Locale defaultLocale) {
474                    String languageId = LocaleUtil.toLanguageId(locale);
475                    String defaultLanguageId = LocaleUtil.toLanguageId(defaultLocale);
476    
477                    if (Validator.isNotNull(name)) {
478                            setName(LocalizationUtil.updateLocalization(getName(), "Name",
479                                            name, languageId, defaultLanguageId));
480                    }
481                    else {
482                            setName(LocalizationUtil.removeLocalization(getName(), "Name",
483                                            languageId));
484                    }
485            }
486    
487            public void setNameCurrentLanguageId(String languageId) {
488                    _nameCurrentLanguageId = languageId;
489            }
490    
491            public void setNameMap(Map<Locale, String> nameMap) {
492                    setNameMap(nameMap, LocaleUtil.getDefault());
493            }
494    
495            public void setNameMap(Map<Locale, String> nameMap, Locale defaultLocale) {
496                    if (nameMap == null) {
497                            return;
498                    }
499    
500                    Locale[] locales = LanguageUtil.getAvailableLocales();
501    
502                    for (Locale locale : locales) {
503                            String name = nameMap.get(locale);
504    
505                            setName(name, locale, defaultLocale);
506                    }
507            }
508    
509            @JSON
510            public String getDescription() {
511                    if (_description == null) {
512                            return StringPool.BLANK;
513                    }
514                    else {
515                            return _description;
516                    }
517            }
518    
519            public String getDescription(Locale locale) {
520                    String languageId = LocaleUtil.toLanguageId(locale);
521    
522                    return getDescription(languageId);
523            }
524    
525            public String getDescription(Locale locale, boolean useDefault) {
526                    String languageId = LocaleUtil.toLanguageId(locale);
527    
528                    return getDescription(languageId, useDefault);
529            }
530    
531            public String getDescription(String languageId) {
532                    return LocalizationUtil.getLocalization(getDescription(), languageId);
533            }
534    
535            public String getDescription(String languageId, boolean useDefault) {
536                    return LocalizationUtil.getLocalization(getDescription(), languageId,
537                            useDefault);
538            }
539    
540            public String getDescriptionCurrentLanguageId() {
541                    return _descriptionCurrentLanguageId;
542            }
543    
544            @JSON
545            public String getDescriptionCurrentValue() {
546                    Locale locale = getLocale(_descriptionCurrentLanguageId);
547    
548                    return getDescription(locale);
549            }
550    
551            public Map<Locale, String> getDescriptionMap() {
552                    return LocalizationUtil.getLocalizationMap(getDescription());
553            }
554    
555            public void setDescription(String description) {
556                    _description = description;
557            }
558    
559            public void setDescription(String description, Locale locale) {
560                    setDescription(description, locale, LocaleUtil.getDefault());
561            }
562    
563            public void setDescription(String description, Locale locale,
564                    Locale defaultLocale) {
565                    String languageId = LocaleUtil.toLanguageId(locale);
566                    String defaultLanguageId = LocaleUtil.toLanguageId(defaultLocale);
567    
568                    if (Validator.isNotNull(description)) {
569                            setDescription(LocalizationUtil.updateLocalization(
570                                            getDescription(), "Description", description, languageId,
571                                            defaultLanguageId));
572                    }
573                    else {
574                            setDescription(LocalizationUtil.removeLocalization(
575                                            getDescription(), "Description", languageId));
576                    }
577            }
578    
579            public void setDescriptionCurrentLanguageId(String languageId) {
580                    _descriptionCurrentLanguageId = languageId;
581            }
582    
583            public void setDescriptionMap(Map<Locale, String> descriptionMap) {
584                    setDescriptionMap(descriptionMap, LocaleUtil.getDefault());
585            }
586    
587            public void setDescriptionMap(Map<Locale, String> descriptionMap,
588                    Locale defaultLocale) {
589                    if (descriptionMap == null) {
590                            return;
591                    }
592    
593                    Locale[] locales = LanguageUtil.getAvailableLocales();
594    
595                    for (Locale locale : locales) {
596                            String description = descriptionMap.get(locale);
597    
598                            setDescription(description, locale, defaultLocale);
599                    }
600            }
601    
602            @JSON
603            public String getType() {
604                    if (_type == null) {
605                            return StringPool.BLANK;
606                    }
607                    else {
608                            return _type;
609                    }
610            }
611    
612            public void setType(String type) {
613                    _type = type;
614            }
615    
616            @JSON
617            public String getTypeSettings() {
618                    if (_typeSettings == null) {
619                            return StringPool.BLANK;
620                    }
621                    else {
622                            return _typeSettings;
623                    }
624            }
625    
626            public void setTypeSettings(String typeSettings) {
627                    _typeSettings = typeSettings;
628            }
629    
630            public long getColumnBitmask() {
631                    return _columnBitmask;
632            }
633    
634            @Override
635            public ExpandoBridge getExpandoBridge() {
636                    return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
637                            MDRRule.class.getName(), getPrimaryKey());
638            }
639    
640            @Override
641            public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
642                    ExpandoBridge expandoBridge = getExpandoBridge();
643    
644                    expandoBridge.setAttributes(serviceContext);
645            }
646    
647            @SuppressWarnings("unused")
648            public void prepareLocalizedFieldsForImport(Locale defaultImportLocale)
649                    throws LocaleException {
650                    setName(getName(defaultImportLocale), defaultImportLocale,
651                            defaultImportLocale);
652                    setDescription(getDescription(defaultImportLocale),
653                            defaultImportLocale, defaultImportLocale);
654            }
655    
656            @Override
657            public MDRRule toEscapedModel() {
658                    if (_escapedModel == null) {
659                            _escapedModel = (MDRRule)ProxyUtil.newProxyInstance(_classLoader,
660                                            _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
661                    }
662    
663                    return _escapedModel;
664            }
665    
666            public MDRRule toUnescapedModel() {
667                    return (MDRRule)this;
668            }
669    
670            @Override
671            public Object clone() {
672                    MDRRuleImpl mdrRuleImpl = new MDRRuleImpl();
673    
674                    mdrRuleImpl.setUuid(getUuid());
675                    mdrRuleImpl.setRuleId(getRuleId());
676                    mdrRuleImpl.setGroupId(getGroupId());
677                    mdrRuleImpl.setCompanyId(getCompanyId());
678                    mdrRuleImpl.setUserId(getUserId());
679                    mdrRuleImpl.setUserName(getUserName());
680                    mdrRuleImpl.setCreateDate(getCreateDate());
681                    mdrRuleImpl.setModifiedDate(getModifiedDate());
682                    mdrRuleImpl.setRuleGroupId(getRuleGroupId());
683                    mdrRuleImpl.setName(getName());
684                    mdrRuleImpl.setDescription(getDescription());
685                    mdrRuleImpl.setType(getType());
686                    mdrRuleImpl.setTypeSettings(getTypeSettings());
687    
688                    mdrRuleImpl.resetOriginalValues();
689    
690                    return mdrRuleImpl;
691            }
692    
693            public int compareTo(MDRRule mdrRule) {
694                    long primaryKey = mdrRule.getPrimaryKey();
695    
696                    if (getPrimaryKey() < primaryKey) {
697                            return -1;
698                    }
699                    else if (getPrimaryKey() > primaryKey) {
700                            return 1;
701                    }
702                    else {
703                            return 0;
704                    }
705            }
706    
707            @Override
708            public boolean equals(Object obj) {
709                    if (this == obj) {
710                            return true;
711                    }
712    
713                    if (!(obj instanceof MDRRule)) {
714                            return false;
715                    }
716    
717                    MDRRule mdrRule = (MDRRule)obj;
718    
719                    long primaryKey = mdrRule.getPrimaryKey();
720    
721                    if (getPrimaryKey() == primaryKey) {
722                            return true;
723                    }
724                    else {
725                            return false;
726                    }
727            }
728    
729            @Override
730            public int hashCode() {
731                    return (int)getPrimaryKey();
732            }
733    
734            @Override
735            public void resetOriginalValues() {
736                    MDRRuleModelImpl mdrRuleModelImpl = this;
737    
738                    mdrRuleModelImpl._originalUuid = mdrRuleModelImpl._uuid;
739    
740                    mdrRuleModelImpl._originalGroupId = mdrRuleModelImpl._groupId;
741    
742                    mdrRuleModelImpl._setOriginalGroupId = false;
743    
744                    mdrRuleModelImpl._originalRuleGroupId = mdrRuleModelImpl._ruleGroupId;
745    
746                    mdrRuleModelImpl._setOriginalRuleGroupId = false;
747    
748                    mdrRuleModelImpl._columnBitmask = 0;
749            }
750    
751            @Override
752            public CacheModel<MDRRule> toCacheModel() {
753                    MDRRuleCacheModel mdrRuleCacheModel = new MDRRuleCacheModel();
754    
755                    mdrRuleCacheModel.uuid = getUuid();
756    
757                    String uuid = mdrRuleCacheModel.uuid;
758    
759                    if ((uuid != null) && (uuid.length() == 0)) {
760                            mdrRuleCacheModel.uuid = null;
761                    }
762    
763                    mdrRuleCacheModel.ruleId = getRuleId();
764    
765                    mdrRuleCacheModel.groupId = getGroupId();
766    
767                    mdrRuleCacheModel.companyId = getCompanyId();
768    
769                    mdrRuleCacheModel.userId = getUserId();
770    
771                    mdrRuleCacheModel.userName = getUserName();
772    
773                    String userName = mdrRuleCacheModel.userName;
774    
775                    if ((userName != null) && (userName.length() == 0)) {
776                            mdrRuleCacheModel.userName = null;
777                    }
778    
779                    Date createDate = getCreateDate();
780    
781                    if (createDate != null) {
782                            mdrRuleCacheModel.createDate = createDate.getTime();
783                    }
784                    else {
785                            mdrRuleCacheModel.createDate = Long.MIN_VALUE;
786                    }
787    
788                    Date modifiedDate = getModifiedDate();
789    
790                    if (modifiedDate != null) {
791                            mdrRuleCacheModel.modifiedDate = modifiedDate.getTime();
792                    }
793                    else {
794                            mdrRuleCacheModel.modifiedDate = Long.MIN_VALUE;
795                    }
796    
797                    mdrRuleCacheModel.ruleGroupId = getRuleGroupId();
798    
799                    mdrRuleCacheModel.name = getName();
800    
801                    String name = mdrRuleCacheModel.name;
802    
803                    if ((name != null) && (name.length() == 0)) {
804                            mdrRuleCacheModel.name = null;
805                    }
806    
807                    mdrRuleCacheModel.description = getDescription();
808    
809                    String description = mdrRuleCacheModel.description;
810    
811                    if ((description != null) && (description.length() == 0)) {
812                            mdrRuleCacheModel.description = null;
813                    }
814    
815                    mdrRuleCacheModel.type = getType();
816    
817                    String type = mdrRuleCacheModel.type;
818    
819                    if ((type != null) && (type.length() == 0)) {
820                            mdrRuleCacheModel.type = null;
821                    }
822    
823                    mdrRuleCacheModel.typeSettings = getTypeSettings();
824    
825                    String typeSettings = mdrRuleCacheModel.typeSettings;
826    
827                    if ((typeSettings != null) && (typeSettings.length() == 0)) {
828                            mdrRuleCacheModel.typeSettings = null;
829                    }
830    
831                    return mdrRuleCacheModel;
832            }
833    
834            @Override
835            public String toString() {
836                    StringBundler sb = new StringBundler(27);
837    
838                    sb.append("{uuid=");
839                    sb.append(getUuid());
840                    sb.append(", ruleId=");
841                    sb.append(getRuleId());
842                    sb.append(", groupId=");
843                    sb.append(getGroupId());
844                    sb.append(", companyId=");
845                    sb.append(getCompanyId());
846                    sb.append(", userId=");
847                    sb.append(getUserId());
848                    sb.append(", userName=");
849                    sb.append(getUserName());
850                    sb.append(", createDate=");
851                    sb.append(getCreateDate());
852                    sb.append(", modifiedDate=");
853                    sb.append(getModifiedDate());
854                    sb.append(", ruleGroupId=");
855                    sb.append(getRuleGroupId());
856                    sb.append(", name=");
857                    sb.append(getName());
858                    sb.append(", description=");
859                    sb.append(getDescription());
860                    sb.append(", type=");
861                    sb.append(getType());
862                    sb.append(", typeSettings=");
863                    sb.append(getTypeSettings());
864                    sb.append("}");
865    
866                    return sb.toString();
867            }
868    
869            public String toXmlString() {
870                    StringBundler sb = new StringBundler(43);
871    
872                    sb.append("<model><model-name>");
873                    sb.append("com.liferay.portlet.mobiledevicerules.model.MDRRule");
874                    sb.append("</model-name>");
875    
876                    sb.append(
877                            "<column><column-name>uuid</column-name><column-value><![CDATA[");
878                    sb.append(getUuid());
879                    sb.append("]]></column-value></column>");
880                    sb.append(
881                            "<column><column-name>ruleId</column-name><column-value><![CDATA[");
882                    sb.append(getRuleId());
883                    sb.append("]]></column-value></column>");
884                    sb.append(
885                            "<column><column-name>groupId</column-name><column-value><![CDATA[");
886                    sb.append(getGroupId());
887                    sb.append("]]></column-value></column>");
888                    sb.append(
889                            "<column><column-name>companyId</column-name><column-value><![CDATA[");
890                    sb.append(getCompanyId());
891                    sb.append("]]></column-value></column>");
892                    sb.append(
893                            "<column><column-name>userId</column-name><column-value><![CDATA[");
894                    sb.append(getUserId());
895                    sb.append("]]></column-value></column>");
896                    sb.append(
897                            "<column><column-name>userName</column-name><column-value><![CDATA[");
898                    sb.append(getUserName());
899                    sb.append("]]></column-value></column>");
900                    sb.append(
901                            "<column><column-name>createDate</column-name><column-value><![CDATA[");
902                    sb.append(getCreateDate());
903                    sb.append("]]></column-value></column>");
904                    sb.append(
905                            "<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
906                    sb.append(getModifiedDate());
907                    sb.append("]]></column-value></column>");
908                    sb.append(
909                            "<column><column-name>ruleGroupId</column-name><column-value><![CDATA[");
910                    sb.append(getRuleGroupId());
911                    sb.append("]]></column-value></column>");
912                    sb.append(
913                            "<column><column-name>name</column-name><column-value><![CDATA[");
914                    sb.append(getName());
915                    sb.append("]]></column-value></column>");
916                    sb.append(
917                            "<column><column-name>description</column-name><column-value><![CDATA[");
918                    sb.append(getDescription());
919                    sb.append("]]></column-value></column>");
920                    sb.append(
921                            "<column><column-name>type</column-name><column-value><![CDATA[");
922                    sb.append(getType());
923                    sb.append("]]></column-value></column>");
924                    sb.append(
925                            "<column><column-name>typeSettings</column-name><column-value><![CDATA[");
926                    sb.append(getTypeSettings());
927                    sb.append("]]></column-value></column>");
928    
929                    sb.append("</model>");
930    
931                    return sb.toString();
932            }
933    
934            private static ClassLoader _classLoader = MDRRule.class.getClassLoader();
935            private static Class<?>[] _escapedModelInterfaces = new Class[] {
936                            MDRRule.class
937                    };
938            private String _uuid;
939            private String _originalUuid;
940            private long _ruleId;
941            private long _groupId;
942            private long _originalGroupId;
943            private boolean _setOriginalGroupId;
944            private long _companyId;
945            private long _userId;
946            private String _userUuid;
947            private String _userName;
948            private Date _createDate;
949            private Date _modifiedDate;
950            private long _ruleGroupId;
951            private long _originalRuleGroupId;
952            private boolean _setOriginalRuleGroupId;
953            private String _name;
954            private String _nameCurrentLanguageId;
955            private String _description;
956            private String _descriptionCurrentLanguageId;
957            private String _type;
958            private String _typeSettings;
959            private long _columnBitmask;
960            private MDRRule _escapedModel;
961    }