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