001
014
015 package com.liferay.portal.model.impl;
016
017 import aQute.bnd.annotation.ProviderType;
018
019 import com.liferay.portal.kernel.util.StringBundler;
020 import com.liferay.portal.kernel.util.StringPool;
021 import com.liferay.portal.model.CacheModel;
022 import com.liferay.portal.model.LayoutFriendlyURL;
023 import com.liferay.portal.model.MVCCModel;
024
025 import java.io.Externalizable;
026 import java.io.IOException;
027 import java.io.ObjectInput;
028 import java.io.ObjectOutput;
029
030 import java.util.Date;
031
032
039 @ProviderType
040 public class LayoutFriendlyURLCacheModel implements CacheModel<LayoutFriendlyURL>,
041 Externalizable, MVCCModel {
042 @Override
043 public long getMvccVersion() {
044 return mvccVersion;
045 }
046
047 @Override
048 public void setMvccVersion(long mvccVersion) {
049 this.mvccVersion = mvccVersion;
050 }
051
052 @Override
053 public String toString() {
054 StringBundler sb = new StringBundler(27);
055
056 sb.append("{mvccVersion=");
057 sb.append(mvccVersion);
058 sb.append(", uuid=");
059 sb.append(uuid);
060 sb.append(", layoutFriendlyURLId=");
061 sb.append(layoutFriendlyURLId);
062 sb.append(", groupId=");
063 sb.append(groupId);
064 sb.append(", companyId=");
065 sb.append(companyId);
066 sb.append(", userId=");
067 sb.append(userId);
068 sb.append(", userName=");
069 sb.append(userName);
070 sb.append(", createDate=");
071 sb.append(createDate);
072 sb.append(", modifiedDate=");
073 sb.append(modifiedDate);
074 sb.append(", plid=");
075 sb.append(plid);
076 sb.append(", privateLayout=");
077 sb.append(privateLayout);
078 sb.append(", friendlyURL=");
079 sb.append(friendlyURL);
080 sb.append(", languageId=");
081 sb.append(languageId);
082 sb.append("}");
083
084 return sb.toString();
085 }
086
087 @Override
088 public LayoutFriendlyURL toEntityModel() {
089 LayoutFriendlyURLImpl layoutFriendlyURLImpl = new LayoutFriendlyURLImpl();
090
091 layoutFriendlyURLImpl.setMvccVersion(mvccVersion);
092
093 if (uuid == null) {
094 layoutFriendlyURLImpl.setUuid(StringPool.BLANK);
095 }
096 else {
097 layoutFriendlyURLImpl.setUuid(uuid);
098 }
099
100 layoutFriendlyURLImpl.setLayoutFriendlyURLId(layoutFriendlyURLId);
101 layoutFriendlyURLImpl.setGroupId(groupId);
102 layoutFriendlyURLImpl.setCompanyId(companyId);
103 layoutFriendlyURLImpl.setUserId(userId);
104
105 if (userName == null) {
106 layoutFriendlyURLImpl.setUserName(StringPool.BLANK);
107 }
108 else {
109 layoutFriendlyURLImpl.setUserName(userName);
110 }
111
112 if (createDate == Long.MIN_VALUE) {
113 layoutFriendlyURLImpl.setCreateDate(null);
114 }
115 else {
116 layoutFriendlyURLImpl.setCreateDate(new Date(createDate));
117 }
118
119 if (modifiedDate == Long.MIN_VALUE) {
120 layoutFriendlyURLImpl.setModifiedDate(null);
121 }
122 else {
123 layoutFriendlyURLImpl.setModifiedDate(new Date(modifiedDate));
124 }
125
126 layoutFriendlyURLImpl.setPlid(plid);
127 layoutFriendlyURLImpl.setPrivateLayout(privateLayout);
128
129 if (friendlyURL == null) {
130 layoutFriendlyURLImpl.setFriendlyURL(StringPool.BLANK);
131 }
132 else {
133 layoutFriendlyURLImpl.setFriendlyURL(friendlyURL);
134 }
135
136 if (languageId == null) {
137 layoutFriendlyURLImpl.setLanguageId(StringPool.BLANK);
138 }
139 else {
140 layoutFriendlyURLImpl.setLanguageId(languageId);
141 }
142
143 layoutFriendlyURLImpl.resetOriginalValues();
144
145 return layoutFriendlyURLImpl;
146 }
147
148 @Override
149 public void readExternal(ObjectInput objectInput) throws IOException {
150 mvccVersion = objectInput.readLong();
151 uuid = objectInput.readUTF();
152 layoutFriendlyURLId = objectInput.readLong();
153 groupId = objectInput.readLong();
154 companyId = objectInput.readLong();
155 userId = objectInput.readLong();
156 userName = objectInput.readUTF();
157 createDate = objectInput.readLong();
158 modifiedDate = objectInput.readLong();
159 plid = objectInput.readLong();
160 privateLayout = objectInput.readBoolean();
161 friendlyURL = objectInput.readUTF();
162 languageId = objectInput.readUTF();
163 }
164
165 @Override
166 public void writeExternal(ObjectOutput objectOutput)
167 throws IOException {
168 objectOutput.writeLong(mvccVersion);
169
170 if (uuid == null) {
171 objectOutput.writeUTF(StringPool.BLANK);
172 }
173 else {
174 objectOutput.writeUTF(uuid);
175 }
176
177 objectOutput.writeLong(layoutFriendlyURLId);
178 objectOutput.writeLong(groupId);
179 objectOutput.writeLong(companyId);
180 objectOutput.writeLong(userId);
181
182 if (userName == null) {
183 objectOutput.writeUTF(StringPool.BLANK);
184 }
185 else {
186 objectOutput.writeUTF(userName);
187 }
188
189 objectOutput.writeLong(createDate);
190 objectOutput.writeLong(modifiedDate);
191 objectOutput.writeLong(plid);
192 objectOutput.writeBoolean(privateLayout);
193
194 if (friendlyURL == null) {
195 objectOutput.writeUTF(StringPool.BLANK);
196 }
197 else {
198 objectOutput.writeUTF(friendlyURL);
199 }
200
201 if (languageId == null) {
202 objectOutput.writeUTF(StringPool.BLANK);
203 }
204 else {
205 objectOutput.writeUTF(languageId);
206 }
207 }
208
209 public long mvccVersion;
210 public String uuid;
211 public long layoutFriendlyURLId;
212 public long groupId;
213 public long companyId;
214 public long userId;
215 public String userName;
216 public long createDate;
217 public long modifiedDate;
218 public long plid;
219 public boolean privateLayout;
220 public String friendlyURL;
221 public String languageId;
222 }