001
014
015 package com.liferay.portal.model.impl;
016
017 import aQute.bnd.annotation.ProviderType;
018
019 import com.liferay.portal.kernel.model.CacheModel;
020 import com.liferay.portal.kernel.model.LayoutPrototype;
021 import com.liferay.portal.kernel.model.MVCCModel;
022 import com.liferay.portal.kernel.util.HashUtil;
023 import com.liferay.portal.kernel.util.StringBundler;
024 import com.liferay.portal.kernel.util.StringPool;
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 LayoutPrototypeCacheModel implements CacheModel<LayoutPrototype>,
042 Externalizable, MVCCModel {
043 @Override
044 public boolean equals(Object obj) {
045 if (this == obj) {
046 return true;
047 }
048
049 if (!(obj instanceof LayoutPrototypeCacheModel)) {
050 return false;
051 }
052
053 LayoutPrototypeCacheModel layoutPrototypeCacheModel = (LayoutPrototypeCacheModel)obj;
054
055 if ((layoutPrototypeId == layoutPrototypeCacheModel.layoutPrototypeId) &&
056 (mvccVersion == layoutPrototypeCacheModel.mvccVersion)) {
057 return true;
058 }
059
060 return false;
061 }
062
063 @Override
064 public int hashCode() {
065 int hashCode = HashUtil.hash(0, layoutPrototypeId);
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(", layoutPrototypeId=");
089 sb.append(layoutPrototypeId);
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 LayoutPrototype toEntityModel() {
115 LayoutPrototypeImpl layoutPrototypeImpl = new LayoutPrototypeImpl();
116
117 layoutPrototypeImpl.setMvccVersion(mvccVersion);
118
119 if (uuid == null) {
120 layoutPrototypeImpl.setUuid(StringPool.BLANK);
121 }
122 else {
123 layoutPrototypeImpl.setUuid(uuid);
124 }
125
126 layoutPrototypeImpl.setLayoutPrototypeId(layoutPrototypeId);
127 layoutPrototypeImpl.setCompanyId(companyId);
128 layoutPrototypeImpl.setUserId(userId);
129
130 if (userName == null) {
131 layoutPrototypeImpl.setUserName(StringPool.BLANK);
132 }
133 else {
134 layoutPrototypeImpl.setUserName(userName);
135 }
136
137 if (createDate == Long.MIN_VALUE) {
138 layoutPrototypeImpl.setCreateDate(null);
139 }
140 else {
141 layoutPrototypeImpl.setCreateDate(new Date(createDate));
142 }
143
144 if (modifiedDate == Long.MIN_VALUE) {
145 layoutPrototypeImpl.setModifiedDate(null);
146 }
147 else {
148 layoutPrototypeImpl.setModifiedDate(new Date(modifiedDate));
149 }
150
151 if (name == null) {
152 layoutPrototypeImpl.setName(StringPool.BLANK);
153 }
154 else {
155 layoutPrototypeImpl.setName(name);
156 }
157
158 if (description == null) {
159 layoutPrototypeImpl.setDescription(StringPool.BLANK);
160 }
161 else {
162 layoutPrototypeImpl.setDescription(description);
163 }
164
165 if (settings == null) {
166 layoutPrototypeImpl.setSettings(StringPool.BLANK);
167 }
168 else {
169 layoutPrototypeImpl.setSettings(settings);
170 }
171
172 layoutPrototypeImpl.setActive(active);
173
174 layoutPrototypeImpl.resetOriginalValues();
175
176 return layoutPrototypeImpl;
177 }
178
179 @Override
180 public void readExternal(ObjectInput objectInput) throws IOException {
181 mvccVersion = objectInput.readLong();
182 uuid = objectInput.readUTF();
183
184 layoutPrototypeId = objectInput.readLong();
185
186 companyId = objectInput.readLong();
187
188 userId = objectInput.readLong();
189 userName = objectInput.readUTF();
190 createDate = objectInput.readLong();
191 modifiedDate = objectInput.readLong();
192 name = objectInput.readUTF();
193 description = objectInput.readUTF();
194 settings = objectInput.readUTF();
195
196 active = objectInput.readBoolean();
197 }
198
199 @Override
200 public void writeExternal(ObjectOutput objectOutput)
201 throws IOException {
202 objectOutput.writeLong(mvccVersion);
203
204 if (uuid == null) {
205 objectOutput.writeUTF(StringPool.BLANK);
206 }
207 else {
208 objectOutput.writeUTF(uuid);
209 }
210
211 objectOutput.writeLong(layoutPrototypeId);
212
213 objectOutput.writeLong(companyId);
214
215 objectOutput.writeLong(userId);
216
217 if (userName == null) {
218 objectOutput.writeUTF(StringPool.BLANK);
219 }
220 else {
221 objectOutput.writeUTF(userName);
222 }
223
224 objectOutput.writeLong(createDate);
225 objectOutput.writeLong(modifiedDate);
226
227 if (name == null) {
228 objectOutput.writeUTF(StringPool.BLANK);
229 }
230 else {
231 objectOutput.writeUTF(name);
232 }
233
234 if (description == null) {
235 objectOutput.writeUTF(StringPool.BLANK);
236 }
237 else {
238 objectOutput.writeUTF(description);
239 }
240
241 if (settings == null) {
242 objectOutput.writeUTF(StringPool.BLANK);
243 }
244 else {
245 objectOutput.writeUTF(settings);
246 }
247
248 objectOutput.writeBoolean(active);
249 }
250
251 public long mvccVersion;
252 public String uuid;
253 public long layoutPrototypeId;
254 public long companyId;
255 public long userId;
256 public String userName;
257 public long createDate;
258 public long modifiedDate;
259 public String name;
260 public String description;
261 public String settings;
262 public boolean active;
263 }