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