001
014
015 package com.liferay.portal.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 import com.liferay.portal.model.LayoutPrototype;
021
022 import java.io.Externalizable;
023 import java.io.IOException;
024 import java.io.ObjectInput;
025 import java.io.ObjectOutput;
026
027 import java.util.Date;
028
029
036 public class LayoutPrototypeCacheModel implements CacheModel<LayoutPrototype>,
037 Externalizable {
038 @Override
039 public String toString() {
040 StringBundler sb = new StringBundler(23);
041
042 sb.append("{uuid=");
043 sb.append(uuid);
044 sb.append(", layoutPrototypeId=");
045 sb.append(layoutPrototypeId);
046 sb.append(", companyId=");
047 sb.append(companyId);
048 sb.append(", userId=");
049 sb.append(userId);
050 sb.append(", userName=");
051 sb.append(userName);
052 sb.append(", createDate=");
053 sb.append(createDate);
054 sb.append(", modifiedDate=");
055 sb.append(modifiedDate);
056 sb.append(", name=");
057 sb.append(name);
058 sb.append(", description=");
059 sb.append(description);
060 sb.append(", settings=");
061 sb.append(settings);
062 sb.append(", active=");
063 sb.append(active);
064 sb.append("}");
065
066 return sb.toString();
067 }
068
069 @Override
070 public LayoutPrototype toEntityModel() {
071 LayoutPrototypeImpl layoutPrototypeImpl = new LayoutPrototypeImpl();
072
073 if (uuid == null) {
074 layoutPrototypeImpl.setUuid(StringPool.BLANK);
075 }
076 else {
077 layoutPrototypeImpl.setUuid(uuid);
078 }
079
080 layoutPrototypeImpl.setLayoutPrototypeId(layoutPrototypeId);
081 layoutPrototypeImpl.setCompanyId(companyId);
082 layoutPrototypeImpl.setUserId(userId);
083
084 if (userName == null) {
085 layoutPrototypeImpl.setUserName(StringPool.BLANK);
086 }
087 else {
088 layoutPrototypeImpl.setUserName(userName);
089 }
090
091 if (createDate == Long.MIN_VALUE) {
092 layoutPrototypeImpl.setCreateDate(null);
093 }
094 else {
095 layoutPrototypeImpl.setCreateDate(new Date(createDate));
096 }
097
098 if (modifiedDate == Long.MIN_VALUE) {
099 layoutPrototypeImpl.setModifiedDate(null);
100 }
101 else {
102 layoutPrototypeImpl.setModifiedDate(new Date(modifiedDate));
103 }
104
105 if (name == null) {
106 layoutPrototypeImpl.setName(StringPool.BLANK);
107 }
108 else {
109 layoutPrototypeImpl.setName(name);
110 }
111
112 if (description == null) {
113 layoutPrototypeImpl.setDescription(StringPool.BLANK);
114 }
115 else {
116 layoutPrototypeImpl.setDescription(description);
117 }
118
119 if (settings == null) {
120 layoutPrototypeImpl.setSettings(StringPool.BLANK);
121 }
122 else {
123 layoutPrototypeImpl.setSettings(settings);
124 }
125
126 layoutPrototypeImpl.setActive(active);
127
128 layoutPrototypeImpl.resetOriginalValues();
129
130 return layoutPrototypeImpl;
131 }
132
133 @Override
134 public void readExternal(ObjectInput objectInput) throws IOException {
135 uuid = objectInput.readUTF();
136 layoutPrototypeId = objectInput.readLong();
137 companyId = objectInput.readLong();
138 userId = objectInput.readLong();
139 userName = objectInput.readUTF();
140 createDate = objectInput.readLong();
141 modifiedDate = objectInput.readLong();
142 name = objectInput.readUTF();
143 description = objectInput.readUTF();
144 settings = objectInput.readUTF();
145 active = objectInput.readBoolean();
146 }
147
148 @Override
149 public void writeExternal(ObjectOutput objectOutput)
150 throws IOException {
151 if (uuid == null) {
152 objectOutput.writeUTF(StringPool.BLANK);
153 }
154 else {
155 objectOutput.writeUTF(uuid);
156 }
157
158 objectOutput.writeLong(layoutPrototypeId);
159 objectOutput.writeLong(companyId);
160 objectOutput.writeLong(userId);
161
162 if (userName == null) {
163 objectOutput.writeUTF(StringPool.BLANK);
164 }
165 else {
166 objectOutput.writeUTF(userName);
167 }
168
169 objectOutput.writeLong(createDate);
170 objectOutput.writeLong(modifiedDate);
171
172 if (name == null) {
173 objectOutput.writeUTF(StringPool.BLANK);
174 }
175 else {
176 objectOutput.writeUTF(name);
177 }
178
179 if (description == null) {
180 objectOutput.writeUTF(StringPool.BLANK);
181 }
182 else {
183 objectOutput.writeUTF(description);
184 }
185
186 if (settings == null) {
187 objectOutput.writeUTF(StringPool.BLANK);
188 }
189 else {
190 objectOutput.writeUTF(settings);
191 }
192
193 objectOutput.writeBoolean(active);
194 }
195
196 public String uuid;
197 public long layoutPrototypeId;
198 public long companyId;
199 public long userId;
200 public String userName;
201 public long createDate;
202 public long modifiedDate;
203 public String name;
204 public String description;
205 public String settings;
206 public boolean active;
207 }