001
014
015 package com.liferay.portlet.mobiledevicerules.model.impl;
016
017 import com.liferay.portal.kernel.util.StringBundler;
018 import com.liferay.portal.kernel.util.StringPool;
019 import com.liferay.portal.model.CacheModel;
020
021 import com.liferay.portlet.mobiledevicerules.model.MDRRule;
022
023 import java.io.Serializable;
024
025 import java.util.Date;
026
027
034 public class MDRRuleCacheModel implements CacheModel<MDRRule>, Serializable {
035 @Override
036 public String toString() {
037 StringBundler sb = new StringBundler(27);
038
039 sb.append("{uuid=");
040 sb.append(uuid);
041 sb.append(", ruleId=");
042 sb.append(ruleId);
043 sb.append(", groupId=");
044 sb.append(groupId);
045 sb.append(", companyId=");
046 sb.append(companyId);
047 sb.append(", userId=");
048 sb.append(userId);
049 sb.append(", userName=");
050 sb.append(userName);
051 sb.append(", createDate=");
052 sb.append(createDate);
053 sb.append(", modifiedDate=");
054 sb.append(modifiedDate);
055 sb.append(", ruleGroupId=");
056 sb.append(ruleGroupId);
057 sb.append(", name=");
058 sb.append(name);
059 sb.append(", description=");
060 sb.append(description);
061 sb.append(", type=");
062 sb.append(type);
063 sb.append(", typeSettings=");
064 sb.append(typeSettings);
065 sb.append("}");
066
067 return sb.toString();
068 }
069
070 public MDRRule toEntityModel() {
071 MDRRuleImpl mdrRuleImpl = new MDRRuleImpl();
072
073 if (uuid == null) {
074 mdrRuleImpl.setUuid(StringPool.BLANK);
075 }
076 else {
077 mdrRuleImpl.setUuid(uuid);
078 }
079
080 mdrRuleImpl.setRuleId(ruleId);
081 mdrRuleImpl.setGroupId(groupId);
082 mdrRuleImpl.setCompanyId(companyId);
083 mdrRuleImpl.setUserId(userId);
084
085 if (userName == null) {
086 mdrRuleImpl.setUserName(StringPool.BLANK);
087 }
088 else {
089 mdrRuleImpl.setUserName(userName);
090 }
091
092 if (createDate == Long.MIN_VALUE) {
093 mdrRuleImpl.setCreateDate(null);
094 }
095 else {
096 mdrRuleImpl.setCreateDate(new Date(createDate));
097 }
098
099 if (modifiedDate == Long.MIN_VALUE) {
100 mdrRuleImpl.setModifiedDate(null);
101 }
102 else {
103 mdrRuleImpl.setModifiedDate(new Date(modifiedDate));
104 }
105
106 mdrRuleImpl.setRuleGroupId(ruleGroupId);
107
108 if (name == null) {
109 mdrRuleImpl.setName(StringPool.BLANK);
110 }
111 else {
112 mdrRuleImpl.setName(name);
113 }
114
115 if (description == null) {
116 mdrRuleImpl.setDescription(StringPool.BLANK);
117 }
118 else {
119 mdrRuleImpl.setDescription(description);
120 }
121
122 if (type == null) {
123 mdrRuleImpl.setType(StringPool.BLANK);
124 }
125 else {
126 mdrRuleImpl.setType(type);
127 }
128
129 if (typeSettings == null) {
130 mdrRuleImpl.setTypeSettings(StringPool.BLANK);
131 }
132 else {
133 mdrRuleImpl.setTypeSettings(typeSettings);
134 }
135
136 mdrRuleImpl.resetOriginalValues();
137
138 return mdrRuleImpl;
139 }
140
141 public String uuid;
142 public long ruleId;
143 public long groupId;
144 public long companyId;
145 public long userId;
146 public String userName;
147 public long createDate;
148 public long modifiedDate;
149 public long ruleGroupId;
150 public String name;
151 public String description;
152 public String type;
153 public String typeSettings;
154 }