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.setEscapedModel(true);
359
360 model.setUuid(HtmlUtil.escape(getUuid()));
361 model.setEntryId(getEntryId());
362 model.setGroupId(getGroupId());
363 model.setCompanyId(getCompanyId());
364 model.setUserId(getUserId());
365 model.setUserName(HtmlUtil.escape(getUserName()));
366 model.setCreateDate(getCreateDate());
367 model.setModifiedDate(getModifiedDate());
368 model.setTitle(HtmlUtil.escape(getTitle()));
369 model.setUrlTitle(HtmlUtil.escape(getUrlTitle()));
370 model.setContent(HtmlUtil.escape(getContent()));
371 model.setDisplayDate(getDisplayDate());
372 model.setDraft(getDraft());
373 model.setAllowTrackbacks(getAllowTrackbacks());
374 model.setTrackbacks(HtmlUtil.escape(getTrackbacks()));
375
376 model = (BlogsEntry)Proxy.newProxyInstance(BlogsEntry.class.getClassLoader(),
377 new Class[] { BlogsEntry.class },
378 new ReadOnlyBeanHandler(model));
379
380 return model;
381 }
382 }
383
384 public Object clone() {
385 BlogsEntryImpl clone = new BlogsEntryImpl();
386
387 clone.setUuid(getUuid());
388 clone.setEntryId(getEntryId());
389 clone.setGroupId(getGroupId());
390 clone.setCompanyId(getCompanyId());
391 clone.setUserId(getUserId());
392 clone.setUserName(getUserName());
393 clone.setCreateDate(getCreateDate());
394 clone.setModifiedDate(getModifiedDate());
395 clone.setTitle(getTitle());
396 clone.setUrlTitle(getUrlTitle());
397 clone.setContent(getContent());
398 clone.setDisplayDate(getDisplayDate());
399 clone.setDraft(getDraft());
400 clone.setAllowTrackbacks(getAllowTrackbacks());
401 clone.setTrackbacks(getTrackbacks());
402
403 return clone;
404 }
405
406 public int compareTo(Object obj) {
407 if (obj == null) {
408 return -1;
409 }
410
411 BlogsEntryImpl blogsEntry = (BlogsEntryImpl)obj;
412
413 int value = 0;
414
415 value = DateUtil.compareTo(getDisplayDate(), blogsEntry.getDisplayDate());
416
417 value = value * -1;
418
419 if (value != 0) {
420 return value;
421 }
422
423 return 0;
424 }
425
426 public boolean equals(Object obj) {
427 if (obj == null) {
428 return false;
429 }
430
431 BlogsEntryImpl blogsEntry = null;
432
433 try {
434 blogsEntry = (BlogsEntryImpl)obj;
435 }
436 catch (ClassCastException cce) {
437 return false;
438 }
439
440 long pk = blogsEntry.getPrimaryKey();
441
442 if (getPrimaryKey() == pk) {
443 return true;
444 }
445 else {
446 return false;
447 }
448 }
449
450 public int hashCode() {
451 return (int)getPrimaryKey();
452 }
453
454 private String _uuid;
455 private long _entryId;
456 private long _groupId;
457 private long _companyId;
458 private long _userId;
459 private String _userName;
460 private Date _createDate;
461 private Date _modifiedDate;
462 private String _title;
463 private String _urlTitle;
464 private String _content;
465 private Date _displayDate;
466 private boolean _draft;
467 private boolean _allowTrackbacks;
468 private String _trackbacks;
469 }