001
014
015 package com.liferay.portlet.journal.model.impl;
016
017 import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
018 import com.liferay.portal.kernel.util.GetterUtil;
019 import com.liferay.portal.kernel.util.ProxyUtil;
020 import com.liferay.portal.kernel.util.StringBundler;
021 import com.liferay.portal.kernel.util.StringPool;
022 import com.liferay.portal.model.CacheModel;
023 import com.liferay.portal.model.impl.BaseModelImpl;
024 import com.liferay.portal.service.ServiceContext;
025
026 import com.liferay.portlet.expando.model.ExpandoBridge;
027 import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
028 import com.liferay.portlet.journal.model.JournalContentSearch;
029 import com.liferay.portlet.journal.model.JournalContentSearchModel;
030
031 import java.io.Serializable;
032
033 import java.sql.Types;
034
035 import java.util.HashMap;
036 import java.util.Map;
037
038
051 public class JournalContentSearchModelImpl extends BaseModelImpl<JournalContentSearch>
052 implements JournalContentSearchModel {
053
058 public static final String TABLE_NAME = "JournalContentSearch";
059 public static final Object[][] TABLE_COLUMNS = {
060 { "contentSearchId", Types.BIGINT },
061 { "groupId", Types.BIGINT },
062 { "companyId", Types.BIGINT },
063 { "privateLayout", Types.BOOLEAN },
064 { "layoutId", Types.BIGINT },
065 { "portletId", Types.VARCHAR },
066 { "articleId", Types.VARCHAR }
067 };
068 public static final String TABLE_SQL_CREATE = "create table JournalContentSearch (contentSearchId LONG not null primary key,groupId LONG,companyId LONG,privateLayout BOOLEAN,layoutId LONG,portletId VARCHAR(200) null,articleId VARCHAR(75) null)";
069 public static final String TABLE_SQL_DROP = "drop table JournalContentSearch";
070 public static final String DATA_SOURCE = "liferayDataSource";
071 public static final String SESSION_FACTORY = "liferaySessionFactory";
072 public static final String TX_MANAGER = "liferayTransactionManager";
073 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
074 "value.object.entity.cache.enabled.com.liferay.portlet.journal.model.JournalContentSearch"),
075 true);
076 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
077 "value.object.finder.cache.enabled.com.liferay.portlet.journal.model.JournalContentSearch"),
078 true);
079 public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
080 "value.object.column.bitmask.enabled.com.liferay.portlet.journal.model.JournalContentSearch"),
081 true);
082 public static long ARTICLEID_COLUMN_BITMASK = 1L;
083 public static long GROUPID_COLUMN_BITMASK = 2L;
084 public static long LAYOUTID_COLUMN_BITMASK = 4L;
085 public static long PORTLETID_COLUMN_BITMASK = 8L;
086 public static long PRIVATELAYOUT_COLUMN_BITMASK = 16L;
087 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
088 "lock.expiration.time.com.liferay.portlet.journal.model.JournalContentSearch"));
089
090 public JournalContentSearchModelImpl() {
091 }
092
093 public long getPrimaryKey() {
094 return _contentSearchId;
095 }
096
097 public void setPrimaryKey(long primaryKey) {
098 setContentSearchId(primaryKey);
099 }
100
101 public Serializable getPrimaryKeyObj() {
102 return new Long(_contentSearchId);
103 }
104
105 public void setPrimaryKeyObj(Serializable primaryKeyObj) {
106 setPrimaryKey(((Long)primaryKeyObj).longValue());
107 }
108
109 public Class<?> getModelClass() {
110 return JournalContentSearch.class;
111 }
112
113 public String getModelClassName() {
114 return JournalContentSearch.class.getName();
115 }
116
117 @Override
118 public Map<String, Object> getModelAttributes() {
119 Map<String, Object> attributes = new HashMap<String, Object>();
120
121 attributes.put("contentSearchId", getContentSearchId());
122 attributes.put("groupId", getGroupId());
123 attributes.put("companyId", getCompanyId());
124 attributes.put("privateLayout", getPrivateLayout());
125 attributes.put("layoutId", getLayoutId());
126 attributes.put("portletId", getPortletId());
127 attributes.put("articleId", getArticleId());
128
129 return attributes;
130 }
131
132 @Override
133 public void setModelAttributes(Map<String, Object> attributes) {
134 Long contentSearchId = (Long)attributes.get("contentSearchId");
135
136 if (contentSearchId != null) {
137 setContentSearchId(contentSearchId);
138 }
139
140 Long groupId = (Long)attributes.get("groupId");
141
142 if (groupId != null) {
143 setGroupId(groupId);
144 }
145
146 Long companyId = (Long)attributes.get("companyId");
147
148 if (companyId != null) {
149 setCompanyId(companyId);
150 }
151
152 Boolean privateLayout = (Boolean)attributes.get("privateLayout");
153
154 if (privateLayout != null) {
155 setPrivateLayout(privateLayout);
156 }
157
158 Long layoutId = (Long)attributes.get("layoutId");
159
160 if (layoutId != null) {
161 setLayoutId(layoutId);
162 }
163
164 String portletId = (String)attributes.get("portletId");
165
166 if (portletId != null) {
167 setPortletId(portletId);
168 }
169
170 String articleId = (String)attributes.get("articleId");
171
172 if (articleId != null) {
173 setArticleId(articleId);
174 }
175 }
176
177 public long getContentSearchId() {
178 return _contentSearchId;
179 }
180
181 public void setContentSearchId(long contentSearchId) {
182 _contentSearchId = contentSearchId;
183 }
184
185 public long getGroupId() {
186 return _groupId;
187 }
188
189 public void setGroupId(long groupId) {
190 _columnBitmask |= GROUPID_COLUMN_BITMASK;
191
192 if (!_setOriginalGroupId) {
193 _setOriginalGroupId = true;
194
195 _originalGroupId = _groupId;
196 }
197
198 _groupId = groupId;
199 }
200
201 public long getOriginalGroupId() {
202 return _originalGroupId;
203 }
204
205 public long getCompanyId() {
206 return _companyId;
207 }
208
209 public void setCompanyId(long companyId) {
210 _companyId = companyId;
211 }
212
213 public boolean getPrivateLayout() {
214 return _privateLayout;
215 }
216
217 public boolean isPrivateLayout() {
218 return _privateLayout;
219 }
220
221 public void setPrivateLayout(boolean privateLayout) {
222 _columnBitmask |= PRIVATELAYOUT_COLUMN_BITMASK;
223
224 if (!_setOriginalPrivateLayout) {
225 _setOriginalPrivateLayout = true;
226
227 _originalPrivateLayout = _privateLayout;
228 }
229
230 _privateLayout = privateLayout;
231 }
232
233 public boolean getOriginalPrivateLayout() {
234 return _originalPrivateLayout;
235 }
236
237 public long getLayoutId() {
238 return _layoutId;
239 }
240
241 public void setLayoutId(long layoutId) {
242 _columnBitmask |= LAYOUTID_COLUMN_BITMASK;
243
244 if (!_setOriginalLayoutId) {
245 _setOriginalLayoutId = true;
246
247 _originalLayoutId = _layoutId;
248 }
249
250 _layoutId = layoutId;
251 }
252
253 public long getOriginalLayoutId() {
254 return _originalLayoutId;
255 }
256
257 public String getPortletId() {
258 if (_portletId == null) {
259 return StringPool.BLANK;
260 }
261 else {
262 return _portletId;
263 }
264 }
265
266 public void setPortletId(String portletId) {
267 _columnBitmask |= PORTLETID_COLUMN_BITMASK;
268
269 if (_originalPortletId == null) {
270 _originalPortletId = _portletId;
271 }
272
273 _portletId = portletId;
274 }
275
276 public String getOriginalPortletId() {
277 return GetterUtil.getString(_originalPortletId);
278 }
279
280 public String getArticleId() {
281 if (_articleId == null) {
282 return StringPool.BLANK;
283 }
284 else {
285 return _articleId;
286 }
287 }
288
289 public void setArticleId(String articleId) {
290 _columnBitmask |= ARTICLEID_COLUMN_BITMASK;
291
292 if (_originalArticleId == null) {
293 _originalArticleId = _articleId;
294 }
295
296 _articleId = articleId;
297 }
298
299 public String getOriginalArticleId() {
300 return GetterUtil.getString(_originalArticleId);
301 }
302
303 public long getColumnBitmask() {
304 return _columnBitmask;
305 }
306
307 @Override
308 public ExpandoBridge getExpandoBridge() {
309 return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
310 JournalContentSearch.class.getName(), getPrimaryKey());
311 }
312
313 @Override
314 public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
315 ExpandoBridge expandoBridge = getExpandoBridge();
316
317 expandoBridge.setAttributes(serviceContext);
318 }
319
320 @Override
321 public JournalContentSearch toEscapedModel() {
322 if (_escapedModel == null) {
323 _escapedModel = (JournalContentSearch)ProxyUtil.newProxyInstance(_classLoader,
324 _escapedModelInterfaces, new AutoEscapeBeanHandler(this));
325 }
326
327 return _escapedModel;
328 }
329
330 public JournalContentSearch toUnescapedModel() {
331 return (JournalContentSearch)this;
332 }
333
334 @Override
335 public Object clone() {
336 JournalContentSearchImpl journalContentSearchImpl = new JournalContentSearchImpl();
337
338 journalContentSearchImpl.setContentSearchId(getContentSearchId());
339 journalContentSearchImpl.setGroupId(getGroupId());
340 journalContentSearchImpl.setCompanyId(getCompanyId());
341 journalContentSearchImpl.setPrivateLayout(getPrivateLayout());
342 journalContentSearchImpl.setLayoutId(getLayoutId());
343 journalContentSearchImpl.setPortletId(getPortletId());
344 journalContentSearchImpl.setArticleId(getArticleId());
345
346 journalContentSearchImpl.resetOriginalValues();
347
348 return journalContentSearchImpl;
349 }
350
351 public int compareTo(JournalContentSearch journalContentSearch) {
352 long primaryKey = journalContentSearch.getPrimaryKey();
353
354 if (getPrimaryKey() < primaryKey) {
355 return -1;
356 }
357 else if (getPrimaryKey() > primaryKey) {
358 return 1;
359 }
360 else {
361 return 0;
362 }
363 }
364
365 @Override
366 public boolean equals(Object obj) {
367 if (this == obj) {
368 return true;
369 }
370
371 if (!(obj instanceof JournalContentSearch)) {
372 return false;
373 }
374
375 JournalContentSearch journalContentSearch = (JournalContentSearch)obj;
376
377 long primaryKey = journalContentSearch.getPrimaryKey();
378
379 if (getPrimaryKey() == primaryKey) {
380 return true;
381 }
382 else {
383 return false;
384 }
385 }
386
387 @Override
388 public int hashCode() {
389 return (int)getPrimaryKey();
390 }
391
392 @Override
393 public void resetOriginalValues() {
394 JournalContentSearchModelImpl journalContentSearchModelImpl = this;
395
396 journalContentSearchModelImpl._originalGroupId = journalContentSearchModelImpl._groupId;
397
398 journalContentSearchModelImpl._setOriginalGroupId = false;
399
400 journalContentSearchModelImpl._originalPrivateLayout = journalContentSearchModelImpl._privateLayout;
401
402 journalContentSearchModelImpl._setOriginalPrivateLayout = false;
403
404 journalContentSearchModelImpl._originalLayoutId = journalContentSearchModelImpl._layoutId;
405
406 journalContentSearchModelImpl._setOriginalLayoutId = false;
407
408 journalContentSearchModelImpl._originalPortletId = journalContentSearchModelImpl._portletId;
409
410 journalContentSearchModelImpl._originalArticleId = journalContentSearchModelImpl._articleId;
411
412 journalContentSearchModelImpl._columnBitmask = 0;
413 }
414
415 @Override
416 public CacheModel<JournalContentSearch> toCacheModel() {
417 JournalContentSearchCacheModel journalContentSearchCacheModel = new JournalContentSearchCacheModel();
418
419 journalContentSearchCacheModel.contentSearchId = getContentSearchId();
420
421 journalContentSearchCacheModel.groupId = getGroupId();
422
423 journalContentSearchCacheModel.companyId = getCompanyId();
424
425 journalContentSearchCacheModel.privateLayout = getPrivateLayout();
426
427 journalContentSearchCacheModel.layoutId = getLayoutId();
428
429 journalContentSearchCacheModel.portletId = getPortletId();
430
431 String portletId = journalContentSearchCacheModel.portletId;
432
433 if ((portletId != null) && (portletId.length() == 0)) {
434 journalContentSearchCacheModel.portletId = null;
435 }
436
437 journalContentSearchCacheModel.articleId = getArticleId();
438
439 String articleId = journalContentSearchCacheModel.articleId;
440
441 if ((articleId != null) && (articleId.length() == 0)) {
442 journalContentSearchCacheModel.articleId = null;
443 }
444
445 return journalContentSearchCacheModel;
446 }
447
448 @Override
449 public String toString() {
450 StringBundler sb = new StringBundler(15);
451
452 sb.append("{contentSearchId=");
453 sb.append(getContentSearchId());
454 sb.append(", groupId=");
455 sb.append(getGroupId());
456 sb.append(", companyId=");
457 sb.append(getCompanyId());
458 sb.append(", privateLayout=");
459 sb.append(getPrivateLayout());
460 sb.append(", layoutId=");
461 sb.append(getLayoutId());
462 sb.append(", portletId=");
463 sb.append(getPortletId());
464 sb.append(", articleId=");
465 sb.append(getArticleId());
466 sb.append("}");
467
468 return sb.toString();
469 }
470
471 public String toXmlString() {
472 StringBundler sb = new StringBundler(25);
473
474 sb.append("<model><model-name>");
475 sb.append("com.liferay.portlet.journal.model.JournalContentSearch");
476 sb.append("</model-name>");
477
478 sb.append(
479 "<column><column-name>contentSearchId</column-name><column-value><![CDATA[");
480 sb.append(getContentSearchId());
481 sb.append("]]></column-value></column>");
482 sb.append(
483 "<column><column-name>groupId</column-name><column-value><![CDATA[");
484 sb.append(getGroupId());
485 sb.append("]]></column-value></column>");
486 sb.append(
487 "<column><column-name>companyId</column-name><column-value><![CDATA[");
488 sb.append(getCompanyId());
489 sb.append("]]></column-value></column>");
490 sb.append(
491 "<column><column-name>privateLayout</column-name><column-value><![CDATA[");
492 sb.append(getPrivateLayout());
493 sb.append("]]></column-value></column>");
494 sb.append(
495 "<column><column-name>layoutId</column-name><column-value><![CDATA[");
496 sb.append(getLayoutId());
497 sb.append("]]></column-value></column>");
498 sb.append(
499 "<column><column-name>portletId</column-name><column-value><![CDATA[");
500 sb.append(getPortletId());
501 sb.append("]]></column-value></column>");
502 sb.append(
503 "<column><column-name>articleId</column-name><column-value><![CDATA[");
504 sb.append(getArticleId());
505 sb.append("]]></column-value></column>");
506
507 sb.append("</model>");
508
509 return sb.toString();
510 }
511
512 private static ClassLoader _classLoader = JournalContentSearch.class.getClassLoader();
513 private static Class<?>[] _escapedModelInterfaces = new Class[] {
514 JournalContentSearch.class
515 };
516 private long _contentSearchId;
517 private long _groupId;
518 private long _originalGroupId;
519 private boolean _setOriginalGroupId;
520 private long _companyId;
521 private boolean _privateLayout;
522 private boolean _originalPrivateLayout;
523 private boolean _setOriginalPrivateLayout;
524 private long _layoutId;
525 private long _originalLayoutId;
526 private boolean _setOriginalLayoutId;
527 private String _portletId;
528 private String _originalPortletId;
529 private String _articleId;
530 private String _originalArticleId;
531 private long _columnBitmask;
532 private JournalContentSearch _escapedModel;
533 }