001
014
015 package com.liferay.portlet.asset.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.asset.model.AssetEntry;
022
023 import java.io.Serializable;
024
025 import java.util.Date;
026
027
034 public class AssetEntryCacheModel implements CacheModel<AssetEntry>,
035 Serializable {
036 @Override
037 public String toString() {
038 StringBundler sb = new StringBundler(53);
039
040 sb.append("{entryId=");
041 sb.append(entryId);
042 sb.append(", groupId=");
043 sb.append(groupId);
044 sb.append(", companyId=");
045 sb.append(companyId);
046 sb.append(", userId=");
047 sb.append(userId);
048 sb.append(", userName=");
049 sb.append(userName);
050 sb.append(", createDate=");
051 sb.append(createDate);
052 sb.append(", modifiedDate=");
053 sb.append(modifiedDate);
054 sb.append(", classNameId=");
055 sb.append(classNameId);
056 sb.append(", classPK=");
057 sb.append(classPK);
058 sb.append(", classUuid=");
059 sb.append(classUuid);
060 sb.append(", classTypeId=");
061 sb.append(classTypeId);
062 sb.append(", visible=");
063 sb.append(visible);
064 sb.append(", startDate=");
065 sb.append(startDate);
066 sb.append(", endDate=");
067 sb.append(endDate);
068 sb.append(", publishDate=");
069 sb.append(publishDate);
070 sb.append(", expirationDate=");
071 sb.append(expirationDate);
072 sb.append(", mimeType=");
073 sb.append(mimeType);
074 sb.append(", title=");
075 sb.append(title);
076 sb.append(", description=");
077 sb.append(description);
078 sb.append(", summary=");
079 sb.append(summary);
080 sb.append(", url=");
081 sb.append(url);
082 sb.append(", layoutUuid=");
083 sb.append(layoutUuid);
084 sb.append(", height=");
085 sb.append(height);
086 sb.append(", width=");
087 sb.append(width);
088 sb.append(", priority=");
089 sb.append(priority);
090 sb.append(", viewCount=");
091 sb.append(viewCount);
092 sb.append("}");
093
094 return sb.toString();
095 }
096
097 public AssetEntry toEntityModel() {
098 AssetEntryImpl assetEntryImpl = new AssetEntryImpl();
099
100 assetEntryImpl.setEntryId(entryId);
101 assetEntryImpl.setGroupId(groupId);
102 assetEntryImpl.setCompanyId(companyId);
103 assetEntryImpl.setUserId(userId);
104
105 if (userName == null) {
106 assetEntryImpl.setUserName(StringPool.BLANK);
107 }
108 else {
109 assetEntryImpl.setUserName(userName);
110 }
111
112 if (createDate == Long.MIN_VALUE) {
113 assetEntryImpl.setCreateDate(null);
114 }
115 else {
116 assetEntryImpl.setCreateDate(new Date(createDate));
117 }
118
119 if (modifiedDate == Long.MIN_VALUE) {
120 assetEntryImpl.setModifiedDate(null);
121 }
122 else {
123 assetEntryImpl.setModifiedDate(new Date(modifiedDate));
124 }
125
126 assetEntryImpl.setClassNameId(classNameId);
127 assetEntryImpl.setClassPK(classPK);
128
129 if (classUuid == null) {
130 assetEntryImpl.setClassUuid(StringPool.BLANK);
131 }
132 else {
133 assetEntryImpl.setClassUuid(classUuid);
134 }
135
136 assetEntryImpl.setClassTypeId(classTypeId);
137 assetEntryImpl.setVisible(visible);
138
139 if (startDate == Long.MIN_VALUE) {
140 assetEntryImpl.setStartDate(null);
141 }
142 else {
143 assetEntryImpl.setStartDate(new Date(startDate));
144 }
145
146 if (endDate == Long.MIN_VALUE) {
147 assetEntryImpl.setEndDate(null);
148 }
149 else {
150 assetEntryImpl.setEndDate(new Date(endDate));
151 }
152
153 if (publishDate == Long.MIN_VALUE) {
154 assetEntryImpl.setPublishDate(null);
155 }
156 else {
157 assetEntryImpl.setPublishDate(new Date(publishDate));
158 }
159
160 if (expirationDate == Long.MIN_VALUE) {
161 assetEntryImpl.setExpirationDate(null);
162 }
163 else {
164 assetEntryImpl.setExpirationDate(new Date(expirationDate));
165 }
166
167 if (mimeType == null) {
168 assetEntryImpl.setMimeType(StringPool.BLANK);
169 }
170 else {
171 assetEntryImpl.setMimeType(mimeType);
172 }
173
174 if (title == null) {
175 assetEntryImpl.setTitle(StringPool.BLANK);
176 }
177 else {
178 assetEntryImpl.setTitle(title);
179 }
180
181 if (description == null) {
182 assetEntryImpl.setDescription(StringPool.BLANK);
183 }
184 else {
185 assetEntryImpl.setDescription(description);
186 }
187
188 if (summary == null) {
189 assetEntryImpl.setSummary(StringPool.BLANK);
190 }
191 else {
192 assetEntryImpl.setSummary(summary);
193 }
194
195 if (url == null) {
196 assetEntryImpl.setUrl(StringPool.BLANK);
197 }
198 else {
199 assetEntryImpl.setUrl(url);
200 }
201
202 if (layoutUuid == null) {
203 assetEntryImpl.setLayoutUuid(StringPool.BLANK);
204 }
205 else {
206 assetEntryImpl.setLayoutUuid(layoutUuid);
207 }
208
209 assetEntryImpl.setHeight(height);
210 assetEntryImpl.setWidth(width);
211 assetEntryImpl.setPriority(priority);
212 assetEntryImpl.setViewCount(viewCount);
213
214 assetEntryImpl.resetOriginalValues();
215
216 return assetEntryImpl;
217 }
218
219 public long entryId;
220 public long groupId;
221 public long companyId;
222 public long userId;
223 public String userName;
224 public long createDate;
225 public long modifiedDate;
226 public long classNameId;
227 public long classPK;
228 public String classUuid;
229 public long classTypeId;
230 public boolean visible;
231 public long startDate;
232 public long endDate;
233 public long publishDate;
234 public long expirationDate;
235 public String mimeType;
236 public String title;
237 public String description;
238 public String summary;
239 public String url;
240 public String layoutUuid;
241 public int height;
242 public int width;
243 public double priority;
244 public int viewCount;
245 }