001
014
015 package com.liferay.portal.model.impl;
016
017 import aQute.bnd.annotation.ProviderType;
018
019 import com.liferay.portal.kernel.util.HashUtil;
020 import com.liferay.portal.kernel.util.StringBundler;
021 import com.liferay.portal.kernel.util.StringPool;
022 import com.liferay.portal.model.CacheModel;
023 import com.liferay.portal.model.LayoutSetPrototype;
024 import com.liferay.portal.model.MVCCModel;
025
026 import java.io.Externalizable;
027 import java.io.IOException;
028 import java.io.ObjectInput;
029 import java.io.ObjectOutput;
030
031 import java.util.Date;
032
033
040 @ProviderType
041 public class LayoutSetPrototypeCacheModel implements CacheModel<LayoutSetPrototype>,
042 Externalizable, MVCCModel {
043 @Override
044 public boolean equals(Object obj) {
045 if (this == obj) {
046 return true;
047 }
048
049 if (!(obj instanceof LayoutSetPrototypeCacheModel)) {
050 return false;
051 }
052
053 LayoutSetPrototypeCacheModel layoutSetPrototypeCacheModel = (LayoutSetPrototypeCacheModel)obj;
054
055 if ((layoutSetPrototypeId == layoutSetPrototypeCacheModel.layoutSetPrototypeId) &&
056 (mvccVersion == layoutSetPrototypeCacheModel.mvccVersion)) {
057 return true;
058 }
059
060 return false;
061 }
062
063 @Override
064 public int hashCode() {
065 int hashCode = HashUtil.hash(0, layoutSetPrototypeId);
066
067 return HashUtil.hash(hashCode, mvccVersion);
068 }
069
070 @Override
071 public long getMvccVersion() {
072 return mvccVersion;
073 }
074
075 @Override
076 public void setMvccVersion(long mvccVersion) {
077 this.mvccVersion = mvccVersion;
078 }
079
080 @Override
081 public String toString() {
082 StringBundler sb = new StringBundler(25);
083
084 sb.append("{mvccVersion=");
085 sb.append(mvccVersion);
086 sb.append(", uuid=");
087 sb.append(uuid);
088 sb.append(", layoutSetPrototypeId=");
089 sb.append(layoutSetPrototypeId);
090 sb.append(", companyId=");
091 sb.append(companyId);
092 sb.append(", userId=");
093 sb.append(userId);
094 sb.append(", userName=");
095 sb.append(userName);
096 sb.append(", createDate=");
097 sb.append(createDate);
098 sb.append(", modifiedDate=");
099 sb.append(modifiedDate);
100 sb.append(", name=");
101 sb.append(name);
102 sb.append(", description=");
103 sb.append(description);
104 sb.append(", settings=");
105 sb.append(settings);
106 sb.append(", active=");
107 sb.append(active);
108 sb.append("}");
109
110 return sb.toString();
111 }
112
113 @Override
114 public LayoutSetPrototype toEntityModel() {
115 LayoutSetPrototypeImpl layoutSetPrototypeImpl = new LayoutSetPrototypeImpl();
116
117 layoutSetPrototypeImpl.setMvccVersion(mvccVersion);
118
119 if (uuid == null) {
120 layoutSetPrototypeImpl.setUuid(StringPool.BLANK);
121 }
122 else {
123 layoutSetPrototypeImpl.setUuid(uuid);
124 }
125
126 layoutSetPrototypeImpl.setLayoutSetPrototypeId(layoutSetPrototypeId);
127 layoutSetPrototypeImpl.setCompanyId(companyId);
128 layoutSetPrototypeImpl.setUserId(userId);
129
130 if (userName == null) {
131 layoutSetPrototypeImpl.setUserName(StringPool.BLANK);
132 }
133 else {
134 layoutSetPrototypeImpl.setUserName(userName);
135 }
136
137 if (createDate == Long.MIN_VALUE) {
138 layoutSetPrototypeImpl.setCreateDate(null);
139 }
140 else {
141 layoutSetPrototypeImpl.setCreateDate(new Date(createDate));
142 }
143
144 if (modifiedDate == Long.MIN_VALUE) {
145 layoutSetPrototypeImpl.setModifiedDate(null);
146 }
147 else {
148 layoutSetPrototypeImpl.setModifiedDate(new Date(modifiedDate));
149 }
150
151 if (name == null) {
152 layoutSetPrototypeImpl.setName(StringPool.BLANK);
153 }
154 else {
155 layoutSetPrototypeImpl.setName(name);
156 }
157
158 if (description == null) {
159 layoutSetPrototypeImpl.setDescription(StringPool.BLANK);
160 }
161 else {
162 layoutSetPrototypeImpl.setDescription(description);
163 }
164
165 if (settings == null) {
166 layoutSetPrototypeImpl.setSettings(StringPool.BLANK);
167 }
168 else {
169 layoutSetPrototypeImpl.setSettings(settings);
170 }
171
172 layoutSetPrototypeImpl.setActive(active);
173
174 layoutSetPrototypeImpl.resetOriginalValues();
175
176 return layoutSetPrototypeImpl;
177 }
178
179 @Override
180 public void readExternal(ObjectInput objectInput) throws IOException {
181 mvccVersion = objectInput.readLong();
182 uuid = objectInput.readUTF();
183 layoutSetPrototypeId = objectInput.readLong();
184 companyId = objectInput.readLong();
185 userId = objectInput.readLong();
186 userName = objectInput.readUTF();
187 createDate = objectInput.readLong();
188 modifiedDate = objectInput.readLong();
189 name = objectInput.readUTF();
190 description = objectInput.readUTF();
191 settings = objectInput.readUTF();
192 active = objectInput.readBoolean();
193 }
194
195 @Override
196 public void writeExternal(ObjectOutput objectOutput)
197 throws IOException {
198 objectOutput.writeLong(mvccVersion);
199
200 if (uuid == null) {
201 objectOutput.writeUTF(StringPool.BLANK);
202 }
203 else {
204 objectOutput.writeUTF(uuid);
205 }
206
207 objectOutput.writeLong(layoutSetPrototypeId);
208 objectOutput.writeLong(companyId);
209 objectOutput.writeLong(userId);
210
211 if (userName == null) {
212 objectOutput.writeUTF(StringPool.BLANK);
213 }
214 else {
215 objectOutput.writeUTF(userName);
216 }
217
218 objectOutput.writeLong(createDate);
219 objectOutput.writeLong(modifiedDate);
220
221 if (name == null) {
222 objectOutput.writeUTF(StringPool.BLANK);
223 }
224 else {
225 objectOutput.writeUTF(name);
226 }
227
228 if (description == null) {
229 objectOutput.writeUTF(StringPool.BLANK);
230 }
231 else {
232 objectOutput.writeUTF(description);
233 }
234
235 if (settings == null) {
236 objectOutput.writeUTF(StringPool.BLANK);
237 }
238 else {
239 objectOutput.writeUTF(settings);
240 }
241
242 objectOutput.writeBoolean(active);
243 }
244
245 public long mvccVersion;
246 public String uuid;
247 public long layoutSetPrototypeId;
248 public long companyId;
249 public long userId;
250 public String userName;
251 public long createDate;
252 public long modifiedDate;
253 public String name;
254 public String description;
255 public String settings;
256 public boolean active;
257 }