1
22
23 package com.liferay.portlet.blogs.model.impl;
24
25 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
26 import com.liferay.portal.kernel.util.DateUtil;
27 import com.liferay.portal.kernel.util.GetterUtil;
28 import com.liferay.portal.kernel.util.HtmlUtil;
29 import com.liferay.portal.model.impl.BaseModelImpl;
30
31 import com.liferay.portlet.blogs.model.BlogsEntry;
32 import com.liferay.portlet.blogs.model.BlogsEntrySoap;
33
34 import java.io.Serializable;
35
36 import java.lang.reflect.Proxy;
37
38 import java.sql.Types;
39
40 import java.util.ArrayList;
41 import java.util.Date;
42 import java.util.List;
43
44
64 public class BlogsEntryModelImpl extends BaseModelImpl {
65 public static final String TABLE_NAME = "BlogsEntry";
66 public static final Object[][] TABLE_COLUMNS = {
67 { "uuid_", new Integer(Types.VARCHAR) },
68
69
70 { "entryId", new Integer(Types.BIGINT) },
71
72
73 { "groupId", new Integer(Types.BIGINT) },
74
75
76 { "companyId", new Integer(Types.BIGINT) },
77
78
79 { "userId", new Integer(Types.BIGINT) },
80
81
82 { "userName", new Integer(Types.VARCHAR) },
83
84
85 { "createDate", new Integer(Types.TIMESTAMP) },
86
87
88 { "modifiedDate", new Integer(Types.TIMESTAMP) },
89
90
91 { "title", new Integer(Types.VARCHAR) },
92
93
94 { "urlTitle", new Integer(Types.VARCHAR) },
95
96
97 { "content", new Integer(Types.CLOB) },
98
99
100 { "displayDate", new Integer(Types.TIMESTAMP) },
101
102
103 { "draft", new Integer(Types.BOOLEAN) },
104
105
106 { "allowTrackbacks", new Integer(Types.BOOLEAN) },
107
108
109 { "trackbacks", new Integer(Types.CLOB) }
110 };
111 public static final String TABLE_SQL_CREATE = "create table BlogsEntry (uuid_ VARCHAR(75) null,entryId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,title VARCHAR(150) null,urlTitle VARCHAR(150) null,content TEXT null,displayDate DATE null,draft BOOLEAN,allowTrackbacks BOOLEAN,trackbacks TEXT null)";
112 public static final String TABLE_SQL_DROP = "drop table BlogsEntry";
113 public static final String DATA_SOURCE = "liferayDataSource";
114 public static final String SESSION_FACTORY = "liferaySessionFactory";
115 public static final String TX_MANAGER = "liferayTransactionManager";
116 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
117 "value.object.finder.cache.enabled.com.liferay.portlet.blogs.model.BlogsEntry"),
118 true);
119
120 public static BlogsEntry toModel(BlogsEntrySoap soapModel) {
121 BlogsEntry model = new BlogsEntryImpl();
122
123 model.setUuid(soapModel.getUuid());
124 model.setEntryId(soapModel.getEntryId());
125 model.setGroupId(soapModel.getGroupId());
126 model.setCompanyId(soapModel.getCompanyId());
127 model.setUserId(soapModel.getUserId());
128 model.setUserName(soapModel.getUserName());
129 model.setCreateDate(soapModel.getCreateDate());
130 model.setModifiedDate(soapModel.getModifiedDate());
131 model.setTitle(soapModel.getTitle());
132 model.setUrlTitle(soapModel.getUrlTitle());
133 model.setContent(soapModel.getContent());
134 model.setDisplayDate(soapModel.getDisplayDate());
135 model.setDraft(soapModel.getDraft());
136 model.setAllowTrackbacks(soapModel.getAllowTrackbacks());
137 model.setTrackbacks(soapModel.getTrackbacks());
138
139 return model;
140 }
141
142 public static List<BlogsEntry> toModels(BlogsEntrySoap[] soapModels) {
143 List<BlogsEntry> models = new ArrayList<BlogsEntry>(soapModels.length);
144
145 for (BlogsEntrySoap soapModel : soapModels) {
146 models.add(toModel(soapModel));
147 }
148
149 return models;
150 }
151
152 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
153 "lock.expiration.time.com.liferay.portlet.blogs.model.BlogsEntry"));
154
155 public BlogsEntryModelImpl() {
156 }
157
158 public long getPrimaryKey() {
159 return _entryId;
160 }
161
162 public void setPrimaryKey(long pk) {
163 setEntryId(pk);
164 }
165
166 public Serializable getPrimaryKeyObj() {
167 return new Long(_entryId);
168 }
169
170 public String getUuid() {
171 return GetterUtil.getString(_uuid);
172 }
173
174 public void setUuid(String uuid) {
175 if ((uuid != null) && (uuid != _uuid)) {
176 _uuid = uuid;
177 }
178 }
179
180 public long getEntryId() {
181 return _entryId;
182 }
183
184 public void setEntryId(long entryId) {
185 if (entryId != _entryId) {
186 _entryId = entryId;
187 }
188 }
189
190 public long getGroupId() {
191 return _groupId;
192 }
193
194 public void setGroupId(long groupId) {
195 if (groupId != _groupId) {
196 _groupId = groupId;
197 }
198 }
199
200 public long getCompanyId() {
201 return _companyId;
202 }
203
204 public void setCompanyId(long companyId) {
205 if (companyId != _companyId) {
206 _companyId = companyId;
207 }
208 }
209
210 public long getUserId() {
211 return _userId;
212 }
213
214 public void setUserId(long userId) {
215 if (userId != _userId) {
216 _userId = userId;
217 }
218 }
219
220 public String getUserName() {
221 return GetterUtil.getString(_userName);
222 }
223
224 public void setUserName(String userName) {
225 if (((userName == null) && (_userName != null)) ||
226 ((userName != null) && (_userName == null)) ||
227 ((userName != null) && (_userName != null) &&
228 !userName.equals(_userName))) {
229 _userName = userName;
230 }
231 }
232
233 public Date getCreateDate() {
234 return _createDate;
235 }
236
237 public void setCreateDate(Date createDate) {
238 if (((createDate == null) && (_createDate != null)) ||
239 ((createDate != null) && (_createDate == null)) ||
240 ((createDate != null) && (_createDate != null) &&
241 !createDate.equals(_createDate))) {
242 _createDate = createDate;
243 }
244 }
245
246 public Date getModifiedDate() {
247 return _modifiedDate;
248 }
249
250 public void setModifiedDate(Date modifiedDate) {
251 if (((modifiedDate == null) && (_modifiedDate != null)) ||
252 ((modifiedDate != null) && (_modifiedDate == null)) ||
253 ((modifiedDate != null) && (_modifiedDate != null) &&
254 !modifiedDate.equals(_modifiedDate))) {
255 _modifiedDate = modifiedDate;
256 }
257 }
258
259 public String getTitle() {
260 return GetterUtil.getString(_title);
261 }
262
263 public void setTitle(String title) {
264 if (((title == null) && (_title != null)) ||
265 ((title != null) && (_title == null)) ||
266 ((title != null) && (_title != null) && !title.equals(_title))) {
267 _title = title;
268 }
269 }
270
271 public String getUrlTitle() {
272 return GetterUtil.getString(_urlTitle);
273 }
274
275 public void setUrlTitle(String urlTitle) {
276 if (((urlTitle == null) && (_urlTitle != null)) ||
277 ((urlTitle != null) && (_urlTitle == null)) ||
278 ((urlTitle != null) && (_urlTitle != null) &&
279 !urlTitle.equals(_urlTitle))) {
280 _urlTitle = urlTitle;
281 }
282 }
283
284 public String getContent() {
285 return GetterUtil.getString(_content);
286 }
287
288 public void setContent(String content) {
289 if (((content == null) && (_content != null)) ||
290 ((content != null) && (_content == null)) ||
291 ((content != null) && (_content != null) &&
292 !content.equals(_content))) {
293 _content = content;
294 }
295 }
296
297 public Date getDisplayDate() {
298 return _displayDate;
299 }
300
301 public void setDisplayDate(Date displayDate) {
302 if (((displayDate == null) && (_displayDate != null)) ||
303 ((displayDate != null) && (_displayDate == null)) ||
304 ((displayDate != null) && (_displayDate != null) &&
305 !displayDate.equals(_displayDate))) {
306 _displayDate = displayDate;
307 }
308 }
309
310 public boolean getDraft() {
311 return _draft;
312 }
313
314 public boolean isDraft() {
315 return _draft;
316 }
317
318 public void setDraft(boolean draft) {
319 if (draft != _draft) {
320 _draft = draft;
321 }
322 }
323
324 public boolean getAllowTrackbacks() {
325 return _allowTrackbacks;
326 }
327
328 public boolean isAllowTrackbacks() {
329 return _allowTrackbacks;
330 }
331
332 public void setAllowTrackbacks(boolean allowTrackbacks) {
333 if (allowTrackbacks != _allowTrackbacks) {
334 _allowTrackbacks = allowTrackbacks;
335 }
336 }
337
338 public String getTrackbacks() {
339 return GetterUtil.getString(_trackbacks);
340 }
341
342 public void setTrackbacks(String trackbacks) {
343 if (((trackbacks == null) && (_trackbacks != null)) ||
344 ((trackbacks != null) && (_trackbacks == null)) ||
345 ((trackbacks != null) && (_trackbacks != null) &&
346 !trackbacks.equals(_trackbacks))) {
347 _trackbacks = trackbacks;
348 }
349 }
350
351 public BlogsEntry toEscapedModel() {
352 if (isEscapedModel()) {
353 return (BlogsEntry)this;
354 }
355 else {
356 BlogsEntry model = new BlogsEntryImpl();
357
358 model.setNew(isNew());
359 model.setEscapedModel(true);
360
361 model.setUuid(HtmlUtil.escape(getUuid()));
362 model.setEntryId(getEntryId());
363 model.setGroupId(getGroupId());
364 model.setCompanyId(getCompanyId());
365 model.setUserId(getUserId());
366 model.setUserName(HtmlUtil.escape(getUserName()));
367 model.setCreateDate(getCreateDate());
368 model.setModifiedDate(getModifiedDate());
369 model.setTitle(HtmlUtil.escape(getTitle()));
370 model.setUrlTitle(HtmlUtil.escape(getUrlTitle()));
371 model.setContent(HtmlUtil.escape(getContent()));
372 model.setDisplayDate(getDisplayDate());
373 model.setDraft(getDraft());
374 model.setAllowTrackbacks(getAllowTrackbacks());
375 model.setTrackbacks(HtmlUtil.escape(getTrackbacks()));
376
377 model = (BlogsEntry)Proxy.newProxyInstance(BlogsEntry.class.getClassLoader(),
378 new Class[] { BlogsEntry.class },
379 new ReadOnlyBeanHandler(model));
380
381 return model;
382 }
383 }
384
385 public Object clone() {
386 BlogsEntryImpl clone = new BlogsEntryImpl();
387
388 clone.setUuid(getUuid());
389 clone.setEntryId(getEntryId());
390 clone.setGroupId(getGroupId());
391 clone.setCompanyId(getCompanyId());
392 clone.setUserId(getUserId());
393 clone.setUserName(getUserName());
394 clone.setCreateDate(getCreateDate());
395 clone.setModifiedDate(getModifiedDate());
396 clone.setTitle(getTitle());
397 clone.setUrlTitle(getUrlTitle());
398 clone.setContent(getContent());
399 clone.setDisplayDate(getDisplayDate());
400 clone.setDraft(getDraft());
401 clone.setAllowTrackbacks(getAllowTrackbacks());
402 clone.setTrackbacks(getTrackbacks());
403
404 return clone;
405 }
406
407 public int compareTo(Object obj) {
408 if (obj == null) {
409 return -1;
410 }
411
412 BlogsEntryImpl blogsEntry = (BlogsEntryImpl)obj;
413
414 int value = 0;
415
416 value = DateUtil.compareTo(getDisplayDate(), blogsEntry.getDisplayDate());
417
418 value = value * -1;
419
420 if (value != 0) {
421 return value;
422 }
423
424 return 0;
425 }
426
427 public boolean equals(Object obj) {
428 if (obj == null) {
429 return false;
430 }
431
432 BlogsEntryImpl blogsEntry = null;
433
434 try {
435 blogsEntry = (BlogsEntryImpl)obj;
436 }
437 catch (ClassCastException cce) {
438 return false;
439 }
440
441 long pk = blogsEntry.getPrimaryKey();
442
443 if (getPrimaryKey() == pk) {
444 return true;
445 }
446 else {
447 return false;
448 }
449 }
450
451 public int hashCode() {
452 return (int)getPrimaryKey();
453 }
454
455 private String _uuid;
456 private long _entryId;
457 private long _groupId;
458 private long _companyId;
459 private long _userId;
460 private String _userName;
461 private Date _createDate;
462 private Date _modifiedDate;
463 private String _title;
464 private String _urlTitle;
465 private String _content;
466 private Date _displayDate;
467 private boolean _draft;
468 private boolean _allowTrackbacks;
469 private String _trackbacks;
470 }