001
014
015 package com.liferay.portlet.journal.service.persistence;
016
017 import com.liferay.portal.NoSuchModelException;
018 import com.liferay.portal.kernel.bean.BeanReference;
019 import com.liferay.portal.kernel.cache.CacheRegistryUtil;
020 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
021 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
022 import com.liferay.portal.kernel.dao.orm.FinderPath;
023 import com.liferay.portal.kernel.dao.orm.Query;
024 import com.liferay.portal.kernel.dao.orm.QueryPos;
025 import com.liferay.portal.kernel.dao.orm.QueryUtil;
026 import com.liferay.portal.kernel.dao.orm.SQLQuery;
027 import com.liferay.portal.kernel.dao.orm.Session;
028 import com.liferay.portal.kernel.exception.SystemException;
029 import com.liferay.portal.kernel.log.Log;
030 import com.liferay.portal.kernel.log.LogFactoryUtil;
031 import com.liferay.portal.kernel.util.GetterUtil;
032 import com.liferay.portal.kernel.util.InstanceFactory;
033 import com.liferay.portal.kernel.util.OrderByComparator;
034 import com.liferay.portal.kernel.util.StringBundler;
035 import com.liferay.portal.kernel.util.StringPool;
036 import com.liferay.portal.kernel.util.StringUtil;
037 import com.liferay.portal.kernel.util.Validator;
038 import com.liferay.portal.kernel.uuid.PortalUUIDUtil;
039 import com.liferay.portal.model.CacheModel;
040 import com.liferay.portal.model.ModelListener;
041 import com.liferay.portal.security.permission.InlineSQLHelperUtil;
042 import com.liferay.portal.service.persistence.BatchSessionUtil;
043 import com.liferay.portal.service.persistence.ResourcePersistence;
044 import com.liferay.portal.service.persistence.UserPersistence;
045 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
046
047 import com.liferay.portlet.expando.service.persistence.ExpandoValuePersistence;
048 import com.liferay.portlet.journal.NoSuchFeedException;
049 import com.liferay.portlet.journal.model.JournalFeed;
050 import com.liferay.portlet.journal.model.impl.JournalFeedImpl;
051 import com.liferay.portlet.journal.model.impl.JournalFeedModelImpl;
052
053 import java.io.Serializable;
054
055 import java.util.ArrayList;
056 import java.util.Collections;
057 import java.util.List;
058
059
071 public class JournalFeedPersistenceImpl extends BasePersistenceImpl<JournalFeed>
072 implements JournalFeedPersistence {
073
078 public static final String FINDER_CLASS_NAME_ENTITY = JournalFeedImpl.class.getName();
079 public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
080 ".List1";
081 public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
082 ".List2";
083 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_UUID = new FinderPath(JournalFeedModelImpl.ENTITY_CACHE_ENABLED,
084 JournalFeedModelImpl.FINDER_CACHE_ENABLED, JournalFeedImpl.class,
085 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByUuid",
086 new String[] {
087 String.class.getName(),
088
089 "java.lang.Integer", "java.lang.Integer",
090 "com.liferay.portal.kernel.util.OrderByComparator"
091 });
092 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID = new FinderPath(JournalFeedModelImpl.ENTITY_CACHE_ENABLED,
093 JournalFeedModelImpl.FINDER_CACHE_ENABLED, JournalFeedImpl.class,
094 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByUuid",
095 new String[] { String.class.getName() },
096 JournalFeedModelImpl.UUID_COLUMN_BITMASK);
097 public static final FinderPath FINDER_PATH_COUNT_BY_UUID = new FinderPath(JournalFeedModelImpl.ENTITY_CACHE_ENABLED,
098 JournalFeedModelImpl.FINDER_CACHE_ENABLED, Long.class,
099 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUuid",
100 new String[] { String.class.getName() });
101 public static final FinderPath FINDER_PATH_FETCH_BY_UUID_G = new FinderPath(JournalFeedModelImpl.ENTITY_CACHE_ENABLED,
102 JournalFeedModelImpl.FINDER_CACHE_ENABLED, JournalFeedImpl.class,
103 FINDER_CLASS_NAME_ENTITY, "fetchByUUID_G",
104 new String[] { String.class.getName(), Long.class.getName() },
105 JournalFeedModelImpl.UUID_COLUMN_BITMASK |
106 JournalFeedModelImpl.GROUPID_COLUMN_BITMASK);
107 public static final FinderPath FINDER_PATH_COUNT_BY_UUID_G = new FinderPath(JournalFeedModelImpl.ENTITY_CACHE_ENABLED,
108 JournalFeedModelImpl.FINDER_CACHE_ENABLED, Long.class,
109 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUUID_G",
110 new String[] { String.class.getName(), Long.class.getName() });
111 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID = new FinderPath(JournalFeedModelImpl.ENTITY_CACHE_ENABLED,
112 JournalFeedModelImpl.FINDER_CACHE_ENABLED, JournalFeedImpl.class,
113 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByGroupId",
114 new String[] {
115 Long.class.getName(),
116
117 "java.lang.Integer", "java.lang.Integer",
118 "com.liferay.portal.kernel.util.OrderByComparator"
119 });
120 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID =
121 new FinderPath(JournalFeedModelImpl.ENTITY_CACHE_ENABLED,
122 JournalFeedModelImpl.FINDER_CACHE_ENABLED, JournalFeedImpl.class,
123 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByGroupId",
124 new String[] { Long.class.getName() },
125 JournalFeedModelImpl.GROUPID_COLUMN_BITMASK);
126 public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(JournalFeedModelImpl.ENTITY_CACHE_ENABLED,
127 JournalFeedModelImpl.FINDER_CACHE_ENABLED, Long.class,
128 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByGroupId",
129 new String[] { Long.class.getName() });
130 public static final FinderPath FINDER_PATH_FETCH_BY_G_F = new FinderPath(JournalFeedModelImpl.ENTITY_CACHE_ENABLED,
131 JournalFeedModelImpl.FINDER_CACHE_ENABLED, JournalFeedImpl.class,
132 FINDER_CLASS_NAME_ENTITY, "fetchByG_F",
133 new String[] { Long.class.getName(), String.class.getName() },
134 JournalFeedModelImpl.GROUPID_COLUMN_BITMASK |
135 JournalFeedModelImpl.FEEDID_COLUMN_BITMASK);
136 public static final FinderPath FINDER_PATH_COUNT_BY_G_F = new FinderPath(JournalFeedModelImpl.ENTITY_CACHE_ENABLED,
137 JournalFeedModelImpl.FINDER_CACHE_ENABLED, Long.class,
138 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_F",
139 new String[] { Long.class.getName(), String.class.getName() });
140 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(JournalFeedModelImpl.ENTITY_CACHE_ENABLED,
141 JournalFeedModelImpl.FINDER_CACHE_ENABLED, JournalFeedImpl.class,
142 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
143 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(JournalFeedModelImpl.ENTITY_CACHE_ENABLED,
144 JournalFeedModelImpl.FINDER_CACHE_ENABLED, JournalFeedImpl.class,
145 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
146 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(JournalFeedModelImpl.ENTITY_CACHE_ENABLED,
147 JournalFeedModelImpl.FINDER_CACHE_ENABLED, Long.class,
148 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
149
150
155 public void cacheResult(JournalFeed journalFeed) {
156 EntityCacheUtil.putResult(JournalFeedModelImpl.ENTITY_CACHE_ENABLED,
157 JournalFeedImpl.class, journalFeed.getPrimaryKey(), journalFeed);
158
159 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
160 new Object[] {
161 journalFeed.getUuid(), Long.valueOf(journalFeed.getGroupId())
162 }, journalFeed);
163
164 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_F,
165 new Object[] {
166 Long.valueOf(journalFeed.getGroupId()),
167
168 journalFeed.getFeedId()
169 }, journalFeed);
170
171 journalFeed.resetOriginalValues();
172 }
173
174
179 public void cacheResult(List<JournalFeed> journalFeeds) {
180 for (JournalFeed journalFeed : journalFeeds) {
181 if (EntityCacheUtil.getResult(
182 JournalFeedModelImpl.ENTITY_CACHE_ENABLED,
183 JournalFeedImpl.class, journalFeed.getPrimaryKey()) == null) {
184 cacheResult(journalFeed);
185 }
186 else {
187 journalFeed.resetOriginalValues();
188 }
189 }
190 }
191
192
199 @Override
200 public void clearCache() {
201 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
202 CacheRegistryUtil.clear(JournalFeedImpl.class.getName());
203 }
204
205 EntityCacheUtil.clearCache(JournalFeedImpl.class.getName());
206
207 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
208 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
209 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
210 }
211
212
219 @Override
220 public void clearCache(JournalFeed journalFeed) {
221 EntityCacheUtil.removeResult(JournalFeedModelImpl.ENTITY_CACHE_ENABLED,
222 JournalFeedImpl.class, journalFeed.getPrimaryKey());
223
224 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
225 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
226
227 clearUniqueFindersCache(journalFeed);
228 }
229
230 @Override
231 public void clearCache(List<JournalFeed> journalFeeds) {
232 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
233 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
234
235 for (JournalFeed journalFeed : journalFeeds) {
236 EntityCacheUtil.removeResult(JournalFeedModelImpl.ENTITY_CACHE_ENABLED,
237 JournalFeedImpl.class, journalFeed.getPrimaryKey());
238
239 clearUniqueFindersCache(journalFeed);
240 }
241 }
242
243 protected void clearUniqueFindersCache(JournalFeed journalFeed) {
244 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
245 new Object[] {
246 journalFeed.getUuid(), Long.valueOf(journalFeed.getGroupId())
247 });
248
249 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_F,
250 new Object[] {
251 Long.valueOf(journalFeed.getGroupId()),
252
253 journalFeed.getFeedId()
254 });
255 }
256
257
263 public JournalFeed create(long id) {
264 JournalFeed journalFeed = new JournalFeedImpl();
265
266 journalFeed.setNew(true);
267 journalFeed.setPrimaryKey(id);
268
269 String uuid = PortalUUIDUtil.generate();
270
271 journalFeed.setUuid(uuid);
272
273 return journalFeed;
274 }
275
276
284 public JournalFeed remove(long id)
285 throws NoSuchFeedException, SystemException {
286 return remove(Long.valueOf(id));
287 }
288
289
297 @Override
298 public JournalFeed remove(Serializable primaryKey)
299 throws NoSuchFeedException, SystemException {
300 Session session = null;
301
302 try {
303 session = openSession();
304
305 JournalFeed journalFeed = (JournalFeed)session.get(JournalFeedImpl.class,
306 primaryKey);
307
308 if (journalFeed == null) {
309 if (_log.isWarnEnabled()) {
310 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
311 }
312
313 throw new NoSuchFeedException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
314 primaryKey);
315 }
316
317 return remove(journalFeed);
318 }
319 catch (NoSuchFeedException nsee) {
320 throw nsee;
321 }
322 catch (Exception e) {
323 throw processException(e);
324 }
325 finally {
326 closeSession(session);
327 }
328 }
329
330 @Override
331 protected JournalFeed removeImpl(JournalFeed journalFeed)
332 throws SystemException {
333 journalFeed = toUnwrappedModel(journalFeed);
334
335 Session session = null;
336
337 try {
338 session = openSession();
339
340 BatchSessionUtil.delete(session, journalFeed);
341 }
342 catch (Exception e) {
343 throw processException(e);
344 }
345 finally {
346 closeSession(session);
347 }
348
349 clearCache(journalFeed);
350
351 return journalFeed;
352 }
353
354 @Override
355 public JournalFeed updateImpl(
356 com.liferay.portlet.journal.model.JournalFeed journalFeed, boolean merge)
357 throws SystemException {
358 journalFeed = toUnwrappedModel(journalFeed);
359
360 boolean isNew = journalFeed.isNew();
361
362 JournalFeedModelImpl journalFeedModelImpl = (JournalFeedModelImpl)journalFeed;
363
364 if (Validator.isNull(journalFeed.getUuid())) {
365 String uuid = PortalUUIDUtil.generate();
366
367 journalFeed.setUuid(uuid);
368 }
369
370 Session session = null;
371
372 try {
373 session = openSession();
374
375 BatchSessionUtil.update(session, journalFeed, merge);
376
377 journalFeed.setNew(false);
378 }
379 catch (Exception e) {
380 throw processException(e);
381 }
382 finally {
383 closeSession(session);
384 }
385
386 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
387
388 if (isNew || !JournalFeedModelImpl.COLUMN_BITMASK_ENABLED) {
389 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
390 }
391
392 else {
393 if ((journalFeedModelImpl.getColumnBitmask() &
394 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID.getColumnBitmask()) != 0) {
395 Object[] args = new Object[] {
396 journalFeedModelImpl.getOriginalUuid()
397 };
398
399 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID, args);
400 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID,
401 args);
402
403 args = new Object[] { journalFeedModelImpl.getUuid() };
404
405 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID, args);
406 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID,
407 args);
408 }
409
410 if ((journalFeedModelImpl.getColumnBitmask() &
411 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID.getColumnBitmask()) != 0) {
412 Object[] args = new Object[] {
413 Long.valueOf(journalFeedModelImpl.getOriginalGroupId())
414 };
415
416 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
417 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
418 args);
419
420 args = new Object[] {
421 Long.valueOf(journalFeedModelImpl.getGroupId())
422 };
423
424 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_GROUPID, args);
425 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID,
426 args);
427 }
428 }
429
430 EntityCacheUtil.putResult(JournalFeedModelImpl.ENTITY_CACHE_ENABLED,
431 JournalFeedImpl.class, journalFeed.getPrimaryKey(), journalFeed);
432
433 if (isNew) {
434 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
435 new Object[] {
436 journalFeed.getUuid(),
437 Long.valueOf(journalFeed.getGroupId())
438 }, journalFeed);
439
440 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_F,
441 new Object[] {
442 Long.valueOf(journalFeed.getGroupId()),
443
444 journalFeed.getFeedId()
445 }, journalFeed);
446 }
447 else {
448 if ((journalFeedModelImpl.getColumnBitmask() &
449 FINDER_PATH_FETCH_BY_UUID_G.getColumnBitmask()) != 0) {
450 Object[] args = new Object[] {
451 journalFeedModelImpl.getOriginalUuid(),
452 Long.valueOf(journalFeedModelImpl.getOriginalGroupId())
453 };
454
455 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID_G, args);
456
457 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G, args);
458
459 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
460 new Object[] {
461 journalFeed.getUuid(),
462 Long.valueOf(journalFeed.getGroupId())
463 }, journalFeed);
464 }
465
466 if ((journalFeedModelImpl.getColumnBitmask() &
467 FINDER_PATH_FETCH_BY_G_F.getColumnBitmask()) != 0) {
468 Object[] args = new Object[] {
469 Long.valueOf(journalFeedModelImpl.getOriginalGroupId()),
470
471 journalFeedModelImpl.getOriginalFeedId()
472 };
473
474 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_G_F, args);
475
476 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_F, args);
477
478 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_F,
479 new Object[] {
480 Long.valueOf(journalFeed.getGroupId()),
481
482 journalFeed.getFeedId()
483 }, journalFeed);
484 }
485 }
486
487 return journalFeed;
488 }
489
490 protected JournalFeed toUnwrappedModel(JournalFeed journalFeed) {
491 if (journalFeed instanceof JournalFeedImpl) {
492 return journalFeed;
493 }
494
495 JournalFeedImpl journalFeedImpl = new JournalFeedImpl();
496
497 journalFeedImpl.setNew(journalFeed.isNew());
498 journalFeedImpl.setPrimaryKey(journalFeed.getPrimaryKey());
499
500 journalFeedImpl.setUuid(journalFeed.getUuid());
501 journalFeedImpl.setId(journalFeed.getId());
502 journalFeedImpl.setGroupId(journalFeed.getGroupId());
503 journalFeedImpl.setCompanyId(journalFeed.getCompanyId());
504 journalFeedImpl.setUserId(journalFeed.getUserId());
505 journalFeedImpl.setUserName(journalFeed.getUserName());
506 journalFeedImpl.setCreateDate(journalFeed.getCreateDate());
507 journalFeedImpl.setModifiedDate(journalFeed.getModifiedDate());
508 journalFeedImpl.setFeedId(journalFeed.getFeedId());
509 journalFeedImpl.setName(journalFeed.getName());
510 journalFeedImpl.setDescription(journalFeed.getDescription());
511 journalFeedImpl.setType(journalFeed.getType());
512 journalFeedImpl.setStructureId(journalFeed.getStructureId());
513 journalFeedImpl.setTemplateId(journalFeed.getTemplateId());
514 journalFeedImpl.setRendererTemplateId(journalFeed.getRendererTemplateId());
515 journalFeedImpl.setDelta(journalFeed.getDelta());
516 journalFeedImpl.setOrderByCol(journalFeed.getOrderByCol());
517 journalFeedImpl.setOrderByType(journalFeed.getOrderByType());
518 journalFeedImpl.setTargetLayoutFriendlyUrl(journalFeed.getTargetLayoutFriendlyUrl());
519 journalFeedImpl.setTargetPortletId(journalFeed.getTargetPortletId());
520 journalFeedImpl.setContentField(journalFeed.getContentField());
521 journalFeedImpl.setFeedType(journalFeed.getFeedType());
522 journalFeedImpl.setFeedVersion(journalFeed.getFeedVersion());
523
524 return journalFeedImpl;
525 }
526
527
535 @Override
536 public JournalFeed findByPrimaryKey(Serializable primaryKey)
537 throws NoSuchModelException, SystemException {
538 return findByPrimaryKey(((Long)primaryKey).longValue());
539 }
540
541
549 public JournalFeed findByPrimaryKey(long id)
550 throws NoSuchFeedException, SystemException {
551 JournalFeed journalFeed = fetchByPrimaryKey(id);
552
553 if (journalFeed == null) {
554 if (_log.isWarnEnabled()) {
555 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + id);
556 }
557
558 throw new NoSuchFeedException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
559 id);
560 }
561
562 return journalFeed;
563 }
564
565
572 @Override
573 public JournalFeed fetchByPrimaryKey(Serializable primaryKey)
574 throws SystemException {
575 return fetchByPrimaryKey(((Long)primaryKey).longValue());
576 }
577
578
585 public JournalFeed fetchByPrimaryKey(long id) throws SystemException {
586 JournalFeed journalFeed = (JournalFeed)EntityCacheUtil.getResult(JournalFeedModelImpl.ENTITY_CACHE_ENABLED,
587 JournalFeedImpl.class, id);
588
589 if (journalFeed == _nullJournalFeed) {
590 return null;
591 }
592
593 if (journalFeed == null) {
594 Session session = null;
595
596 boolean hasException = false;
597
598 try {
599 session = openSession();
600
601 journalFeed = (JournalFeed)session.get(JournalFeedImpl.class,
602 Long.valueOf(id));
603 }
604 catch (Exception e) {
605 hasException = true;
606
607 throw processException(e);
608 }
609 finally {
610 if (journalFeed != null) {
611 cacheResult(journalFeed);
612 }
613 else if (!hasException) {
614 EntityCacheUtil.putResult(JournalFeedModelImpl.ENTITY_CACHE_ENABLED,
615 JournalFeedImpl.class, id, _nullJournalFeed);
616 }
617
618 closeSession(session);
619 }
620 }
621
622 return journalFeed;
623 }
624
625
632 public List<JournalFeed> findByUuid(String uuid) throws SystemException {
633 return findByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
634 }
635
636
649 public List<JournalFeed> findByUuid(String uuid, int start, int end)
650 throws SystemException {
651 return findByUuid(uuid, start, end, null);
652 }
653
654
668 public List<JournalFeed> findByUuid(String uuid, int start, int end,
669 OrderByComparator orderByComparator) throws SystemException {
670 FinderPath finderPath = null;
671 Object[] finderArgs = null;
672
673 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
674 (orderByComparator == null)) {
675 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID;
676 finderArgs = new Object[] { uuid };
677 }
678 else {
679 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_UUID;
680 finderArgs = new Object[] { uuid, start, end, orderByComparator };
681 }
682
683 List<JournalFeed> list = (List<JournalFeed>)FinderCacheUtil.getResult(finderPath,
684 finderArgs, this);
685
686 if ((list != null) && !list.isEmpty()) {
687 for (JournalFeed journalFeed : list) {
688 if (!Validator.equals(uuid, journalFeed.getUuid())) {
689 list = null;
690
691 break;
692 }
693 }
694 }
695
696 if (list == null) {
697 StringBundler query = null;
698
699 if (orderByComparator != null) {
700 query = new StringBundler(3 +
701 (orderByComparator.getOrderByFields().length * 3));
702 }
703 else {
704 query = new StringBundler(3);
705 }
706
707 query.append(_SQL_SELECT_JOURNALFEED_WHERE);
708
709 if (uuid == null) {
710 query.append(_FINDER_COLUMN_UUID_UUID_1);
711 }
712 else {
713 if (uuid.equals(StringPool.BLANK)) {
714 query.append(_FINDER_COLUMN_UUID_UUID_3);
715 }
716 else {
717 query.append(_FINDER_COLUMN_UUID_UUID_2);
718 }
719 }
720
721 if (orderByComparator != null) {
722 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
723 orderByComparator);
724 }
725
726 else {
727 query.append(JournalFeedModelImpl.ORDER_BY_JPQL);
728 }
729
730 String sql = query.toString();
731
732 Session session = null;
733
734 try {
735 session = openSession();
736
737 Query q = session.createQuery(sql);
738
739 QueryPos qPos = QueryPos.getInstance(q);
740
741 if (uuid != null) {
742 qPos.add(uuid);
743 }
744
745 list = (List<JournalFeed>)QueryUtil.list(q, getDialect(),
746 start, end);
747 }
748 catch (Exception e) {
749 throw processException(e);
750 }
751 finally {
752 if (list == null) {
753 FinderCacheUtil.removeResult(finderPath, finderArgs);
754 }
755 else {
756 cacheResult(list);
757
758 FinderCacheUtil.putResult(finderPath, finderArgs, list);
759 }
760
761 closeSession(session);
762 }
763 }
764
765 return list;
766 }
767
768
777 public JournalFeed findByUuid_First(String uuid,
778 OrderByComparator orderByComparator)
779 throws NoSuchFeedException, SystemException {
780 JournalFeed journalFeed = fetchByUuid_First(uuid, orderByComparator);
781
782 if (journalFeed != null) {
783 return journalFeed;
784 }
785
786 StringBundler msg = new StringBundler(4);
787
788 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
789
790 msg.append("uuid=");
791 msg.append(uuid);
792
793 msg.append(StringPool.CLOSE_CURLY_BRACE);
794
795 throw new NoSuchFeedException(msg.toString());
796 }
797
798
806 public JournalFeed fetchByUuid_First(String uuid,
807 OrderByComparator orderByComparator) throws SystemException {
808 List<JournalFeed> list = findByUuid(uuid, 0, 1, orderByComparator);
809
810 if (!list.isEmpty()) {
811 return list.get(0);
812 }
813
814 return null;
815 }
816
817
826 public JournalFeed findByUuid_Last(String uuid,
827 OrderByComparator orderByComparator)
828 throws NoSuchFeedException, SystemException {
829 JournalFeed journalFeed = fetchByUuid_Last(uuid, orderByComparator);
830
831 if (journalFeed != null) {
832 return journalFeed;
833 }
834
835 StringBundler msg = new StringBundler(4);
836
837 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
838
839 msg.append("uuid=");
840 msg.append(uuid);
841
842 msg.append(StringPool.CLOSE_CURLY_BRACE);
843
844 throw new NoSuchFeedException(msg.toString());
845 }
846
847
855 public JournalFeed fetchByUuid_Last(String uuid,
856 OrderByComparator orderByComparator) throws SystemException {
857 int count = countByUuid(uuid);
858
859 List<JournalFeed> list = findByUuid(uuid, count - 1, count,
860 orderByComparator);
861
862 if (!list.isEmpty()) {
863 return list.get(0);
864 }
865
866 return null;
867 }
868
869
879 public JournalFeed[] findByUuid_PrevAndNext(long id, String uuid,
880 OrderByComparator orderByComparator)
881 throws NoSuchFeedException, SystemException {
882 JournalFeed journalFeed = findByPrimaryKey(id);
883
884 Session session = null;
885
886 try {
887 session = openSession();
888
889 JournalFeed[] array = new JournalFeedImpl[3];
890
891 array[0] = getByUuid_PrevAndNext(session, journalFeed, uuid,
892 orderByComparator, true);
893
894 array[1] = journalFeed;
895
896 array[2] = getByUuid_PrevAndNext(session, journalFeed, uuid,
897 orderByComparator, false);
898
899 return array;
900 }
901 catch (Exception e) {
902 throw processException(e);
903 }
904 finally {
905 closeSession(session);
906 }
907 }
908
909 protected JournalFeed getByUuid_PrevAndNext(Session session,
910 JournalFeed journalFeed, String uuid,
911 OrderByComparator orderByComparator, boolean previous) {
912 StringBundler query = null;
913
914 if (orderByComparator != null) {
915 query = new StringBundler(6 +
916 (orderByComparator.getOrderByFields().length * 6));
917 }
918 else {
919 query = new StringBundler(3);
920 }
921
922 query.append(_SQL_SELECT_JOURNALFEED_WHERE);
923
924 if (uuid == null) {
925 query.append(_FINDER_COLUMN_UUID_UUID_1);
926 }
927 else {
928 if (uuid.equals(StringPool.BLANK)) {
929 query.append(_FINDER_COLUMN_UUID_UUID_3);
930 }
931 else {
932 query.append(_FINDER_COLUMN_UUID_UUID_2);
933 }
934 }
935
936 if (orderByComparator != null) {
937 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
938
939 if (orderByConditionFields.length > 0) {
940 query.append(WHERE_AND);
941 }
942
943 for (int i = 0; i < orderByConditionFields.length; i++) {
944 query.append(_ORDER_BY_ENTITY_ALIAS);
945 query.append(orderByConditionFields[i]);
946
947 if ((i + 1) < orderByConditionFields.length) {
948 if (orderByComparator.isAscending() ^ previous) {
949 query.append(WHERE_GREATER_THAN_HAS_NEXT);
950 }
951 else {
952 query.append(WHERE_LESSER_THAN_HAS_NEXT);
953 }
954 }
955 else {
956 if (orderByComparator.isAscending() ^ previous) {
957 query.append(WHERE_GREATER_THAN);
958 }
959 else {
960 query.append(WHERE_LESSER_THAN);
961 }
962 }
963 }
964
965 query.append(ORDER_BY_CLAUSE);
966
967 String[] orderByFields = orderByComparator.getOrderByFields();
968
969 for (int i = 0; i < orderByFields.length; i++) {
970 query.append(_ORDER_BY_ENTITY_ALIAS);
971 query.append(orderByFields[i]);
972
973 if ((i + 1) < orderByFields.length) {
974 if (orderByComparator.isAscending() ^ previous) {
975 query.append(ORDER_BY_ASC_HAS_NEXT);
976 }
977 else {
978 query.append(ORDER_BY_DESC_HAS_NEXT);
979 }
980 }
981 else {
982 if (orderByComparator.isAscending() ^ previous) {
983 query.append(ORDER_BY_ASC);
984 }
985 else {
986 query.append(ORDER_BY_DESC);
987 }
988 }
989 }
990 }
991
992 else {
993 query.append(JournalFeedModelImpl.ORDER_BY_JPQL);
994 }
995
996 String sql = query.toString();
997
998 Query q = session.createQuery(sql);
999
1000 q.setFirstResult(0);
1001 q.setMaxResults(2);
1002
1003 QueryPos qPos = QueryPos.getInstance(q);
1004
1005 if (uuid != null) {
1006 qPos.add(uuid);
1007 }
1008
1009 if (orderByComparator != null) {
1010 Object[] values = orderByComparator.getOrderByConditionValues(journalFeed);
1011
1012 for (Object value : values) {
1013 qPos.add(value);
1014 }
1015 }
1016
1017 List<JournalFeed> list = q.list();
1018
1019 if (list.size() == 2) {
1020 return list.get(1);
1021 }
1022 else {
1023 return null;
1024 }
1025 }
1026
1027
1036 public JournalFeed findByUUID_G(String uuid, long groupId)
1037 throws NoSuchFeedException, SystemException {
1038 JournalFeed journalFeed = fetchByUUID_G(uuid, groupId);
1039
1040 if (journalFeed == null) {
1041 StringBundler msg = new StringBundler(6);
1042
1043 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1044
1045 msg.append("uuid=");
1046 msg.append(uuid);
1047
1048 msg.append(", groupId=");
1049 msg.append(groupId);
1050
1051 msg.append(StringPool.CLOSE_CURLY_BRACE);
1052
1053 if (_log.isWarnEnabled()) {
1054 _log.warn(msg.toString());
1055 }
1056
1057 throw new NoSuchFeedException(msg.toString());
1058 }
1059
1060 return journalFeed;
1061 }
1062
1063
1071 public JournalFeed fetchByUUID_G(String uuid, long groupId)
1072 throws SystemException {
1073 return fetchByUUID_G(uuid, groupId, true);
1074 }
1075
1076
1085 public JournalFeed fetchByUUID_G(String uuid, long groupId,
1086 boolean retrieveFromCache) throws SystemException {
1087 Object[] finderArgs = new Object[] { uuid, groupId };
1088
1089 Object result = null;
1090
1091 if (retrieveFromCache) {
1092 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_UUID_G,
1093 finderArgs, this);
1094 }
1095
1096 if (result instanceof JournalFeed) {
1097 JournalFeed journalFeed = (JournalFeed)result;
1098
1099 if (!Validator.equals(uuid, journalFeed.getUuid()) ||
1100 (groupId != journalFeed.getGroupId())) {
1101 result = null;
1102 }
1103 }
1104
1105 if (result == null) {
1106 StringBundler query = new StringBundler(4);
1107
1108 query.append(_SQL_SELECT_JOURNALFEED_WHERE);
1109
1110 if (uuid == null) {
1111 query.append(_FINDER_COLUMN_UUID_G_UUID_1);
1112 }
1113 else {
1114 if (uuid.equals(StringPool.BLANK)) {
1115 query.append(_FINDER_COLUMN_UUID_G_UUID_3);
1116 }
1117 else {
1118 query.append(_FINDER_COLUMN_UUID_G_UUID_2);
1119 }
1120 }
1121
1122 query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
1123
1124 query.append(JournalFeedModelImpl.ORDER_BY_JPQL);
1125
1126 String sql = query.toString();
1127
1128 Session session = null;
1129
1130 try {
1131 session = openSession();
1132
1133 Query q = session.createQuery(sql);
1134
1135 QueryPos qPos = QueryPos.getInstance(q);
1136
1137 if (uuid != null) {
1138 qPos.add(uuid);
1139 }
1140
1141 qPos.add(groupId);
1142
1143 List<JournalFeed> list = q.list();
1144
1145 result = list;
1146
1147 JournalFeed journalFeed = null;
1148
1149 if (list.isEmpty()) {
1150 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1151 finderArgs, list);
1152 }
1153 else {
1154 journalFeed = list.get(0);
1155
1156 cacheResult(journalFeed);
1157
1158 if ((journalFeed.getUuid() == null) ||
1159 !journalFeed.getUuid().equals(uuid) ||
1160 (journalFeed.getGroupId() != groupId)) {
1161 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
1162 finderArgs, journalFeed);
1163 }
1164 }
1165
1166 return journalFeed;
1167 }
1168 catch (Exception e) {
1169 throw processException(e);
1170 }
1171 finally {
1172 if (result == null) {
1173 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
1174 finderArgs);
1175 }
1176
1177 closeSession(session);
1178 }
1179 }
1180 else {
1181 if (result instanceof List<?>) {
1182 return null;
1183 }
1184 else {
1185 return (JournalFeed)result;
1186 }
1187 }
1188 }
1189
1190
1197 public List<JournalFeed> findByGroupId(long groupId)
1198 throws SystemException {
1199 return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1200 }
1201
1202
1215 public List<JournalFeed> findByGroupId(long groupId, int start, int end)
1216 throws SystemException {
1217 return findByGroupId(groupId, start, end, null);
1218 }
1219
1220
1234 public List<JournalFeed> findByGroupId(long groupId, int start, int end,
1235 OrderByComparator orderByComparator) throws SystemException {
1236 FinderPath finderPath = null;
1237 Object[] finderArgs = null;
1238
1239 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1240 (orderByComparator == null)) {
1241 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_GROUPID;
1242 finderArgs = new Object[] { groupId };
1243 }
1244 else {
1245 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_GROUPID;
1246 finderArgs = new Object[] { groupId, start, end, orderByComparator };
1247 }
1248
1249 List<JournalFeed> list = (List<JournalFeed>)FinderCacheUtil.getResult(finderPath,
1250 finderArgs, this);
1251
1252 if ((list != null) && !list.isEmpty()) {
1253 for (JournalFeed journalFeed : list) {
1254 if ((groupId != journalFeed.getGroupId())) {
1255 list = null;
1256
1257 break;
1258 }
1259 }
1260 }
1261
1262 if (list == null) {
1263 StringBundler query = null;
1264
1265 if (orderByComparator != null) {
1266 query = new StringBundler(3 +
1267 (orderByComparator.getOrderByFields().length * 3));
1268 }
1269 else {
1270 query = new StringBundler(3);
1271 }
1272
1273 query.append(_SQL_SELECT_JOURNALFEED_WHERE);
1274
1275 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1276
1277 if (orderByComparator != null) {
1278 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1279 orderByComparator);
1280 }
1281
1282 else {
1283 query.append(JournalFeedModelImpl.ORDER_BY_JPQL);
1284 }
1285
1286 String sql = query.toString();
1287
1288 Session session = null;
1289
1290 try {
1291 session = openSession();
1292
1293 Query q = session.createQuery(sql);
1294
1295 QueryPos qPos = QueryPos.getInstance(q);
1296
1297 qPos.add(groupId);
1298
1299 list = (List<JournalFeed>)QueryUtil.list(q, getDialect(),
1300 start, end);
1301 }
1302 catch (Exception e) {
1303 throw processException(e);
1304 }
1305 finally {
1306 if (list == null) {
1307 FinderCacheUtil.removeResult(finderPath, finderArgs);
1308 }
1309 else {
1310 cacheResult(list);
1311
1312 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1313 }
1314
1315 closeSession(session);
1316 }
1317 }
1318
1319 return list;
1320 }
1321
1322
1331 public JournalFeed findByGroupId_First(long groupId,
1332 OrderByComparator orderByComparator)
1333 throws NoSuchFeedException, SystemException {
1334 JournalFeed journalFeed = fetchByGroupId_First(groupId,
1335 orderByComparator);
1336
1337 if (journalFeed != null) {
1338 return journalFeed;
1339 }
1340
1341 StringBundler msg = new StringBundler(4);
1342
1343 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1344
1345 msg.append("groupId=");
1346 msg.append(groupId);
1347
1348 msg.append(StringPool.CLOSE_CURLY_BRACE);
1349
1350 throw new NoSuchFeedException(msg.toString());
1351 }
1352
1353
1361 public JournalFeed fetchByGroupId_First(long groupId,
1362 OrderByComparator orderByComparator) throws SystemException {
1363 List<JournalFeed> list = findByGroupId(groupId, 0, 1, orderByComparator);
1364
1365 if (!list.isEmpty()) {
1366 return list.get(0);
1367 }
1368
1369 return null;
1370 }
1371
1372
1381 public JournalFeed findByGroupId_Last(long groupId,
1382 OrderByComparator orderByComparator)
1383 throws NoSuchFeedException, SystemException {
1384 JournalFeed journalFeed = fetchByGroupId_Last(groupId, orderByComparator);
1385
1386 if (journalFeed != null) {
1387 return journalFeed;
1388 }
1389
1390 StringBundler msg = new StringBundler(4);
1391
1392 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1393
1394 msg.append("groupId=");
1395 msg.append(groupId);
1396
1397 msg.append(StringPool.CLOSE_CURLY_BRACE);
1398
1399 throw new NoSuchFeedException(msg.toString());
1400 }
1401
1402
1410 public JournalFeed fetchByGroupId_Last(long groupId,
1411 OrderByComparator orderByComparator) throws SystemException {
1412 int count = countByGroupId(groupId);
1413
1414 List<JournalFeed> list = findByGroupId(groupId, count - 1, count,
1415 orderByComparator);
1416
1417 if (!list.isEmpty()) {
1418 return list.get(0);
1419 }
1420
1421 return null;
1422 }
1423
1424
1434 public JournalFeed[] findByGroupId_PrevAndNext(long id, long groupId,
1435 OrderByComparator orderByComparator)
1436 throws NoSuchFeedException, SystemException {
1437 JournalFeed journalFeed = findByPrimaryKey(id);
1438
1439 Session session = null;
1440
1441 try {
1442 session = openSession();
1443
1444 JournalFeed[] array = new JournalFeedImpl[3];
1445
1446 array[0] = getByGroupId_PrevAndNext(session, journalFeed, groupId,
1447 orderByComparator, true);
1448
1449 array[1] = journalFeed;
1450
1451 array[2] = getByGroupId_PrevAndNext(session, journalFeed, groupId,
1452 orderByComparator, false);
1453
1454 return array;
1455 }
1456 catch (Exception e) {
1457 throw processException(e);
1458 }
1459 finally {
1460 closeSession(session);
1461 }
1462 }
1463
1464 protected JournalFeed getByGroupId_PrevAndNext(Session session,
1465 JournalFeed journalFeed, long groupId,
1466 OrderByComparator orderByComparator, boolean previous) {
1467 StringBundler query = null;
1468
1469 if (orderByComparator != null) {
1470 query = new StringBundler(6 +
1471 (orderByComparator.getOrderByFields().length * 6));
1472 }
1473 else {
1474 query = new StringBundler(3);
1475 }
1476
1477 query.append(_SQL_SELECT_JOURNALFEED_WHERE);
1478
1479 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1480
1481 if (orderByComparator != null) {
1482 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1483
1484 if (orderByConditionFields.length > 0) {
1485 query.append(WHERE_AND);
1486 }
1487
1488 for (int i = 0; i < orderByConditionFields.length; i++) {
1489 query.append(_ORDER_BY_ENTITY_ALIAS);
1490 query.append(orderByConditionFields[i]);
1491
1492 if ((i + 1) < orderByConditionFields.length) {
1493 if (orderByComparator.isAscending() ^ previous) {
1494 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1495 }
1496 else {
1497 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1498 }
1499 }
1500 else {
1501 if (orderByComparator.isAscending() ^ previous) {
1502 query.append(WHERE_GREATER_THAN);
1503 }
1504 else {
1505 query.append(WHERE_LESSER_THAN);
1506 }
1507 }
1508 }
1509
1510 query.append(ORDER_BY_CLAUSE);
1511
1512 String[] orderByFields = orderByComparator.getOrderByFields();
1513
1514 for (int i = 0; i < orderByFields.length; i++) {
1515 query.append(_ORDER_BY_ENTITY_ALIAS);
1516 query.append(orderByFields[i]);
1517
1518 if ((i + 1) < orderByFields.length) {
1519 if (orderByComparator.isAscending() ^ previous) {
1520 query.append(ORDER_BY_ASC_HAS_NEXT);
1521 }
1522 else {
1523 query.append(ORDER_BY_DESC_HAS_NEXT);
1524 }
1525 }
1526 else {
1527 if (orderByComparator.isAscending() ^ previous) {
1528 query.append(ORDER_BY_ASC);
1529 }
1530 else {
1531 query.append(ORDER_BY_DESC);
1532 }
1533 }
1534 }
1535 }
1536
1537 else {
1538 query.append(JournalFeedModelImpl.ORDER_BY_JPQL);
1539 }
1540
1541 String sql = query.toString();
1542
1543 Query q = session.createQuery(sql);
1544
1545 q.setFirstResult(0);
1546 q.setMaxResults(2);
1547
1548 QueryPos qPos = QueryPos.getInstance(q);
1549
1550 qPos.add(groupId);
1551
1552 if (orderByComparator != null) {
1553 Object[] values = orderByComparator.getOrderByConditionValues(journalFeed);
1554
1555 for (Object value : values) {
1556 qPos.add(value);
1557 }
1558 }
1559
1560 List<JournalFeed> list = q.list();
1561
1562 if (list.size() == 2) {
1563 return list.get(1);
1564 }
1565 else {
1566 return null;
1567 }
1568 }
1569
1570
1577 public List<JournalFeed> filterFindByGroupId(long groupId)
1578 throws SystemException {
1579 return filterFindByGroupId(groupId, QueryUtil.ALL_POS,
1580 QueryUtil.ALL_POS, null);
1581 }
1582
1583
1596 public List<JournalFeed> filterFindByGroupId(long groupId, int start,
1597 int end) throws SystemException {
1598 return filterFindByGroupId(groupId, start, end, null);
1599 }
1600
1601
1615 public List<JournalFeed> filterFindByGroupId(long groupId, int start,
1616 int end, OrderByComparator orderByComparator) throws SystemException {
1617 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1618 return findByGroupId(groupId, start, end, orderByComparator);
1619 }
1620
1621 StringBundler query = null;
1622
1623 if (orderByComparator != null) {
1624 query = new StringBundler(3 +
1625 (orderByComparator.getOrderByFields().length * 3));
1626 }
1627 else {
1628 query = new StringBundler(3);
1629 }
1630
1631 if (getDB().isSupportsInlineDistinct()) {
1632 query.append(_FILTER_SQL_SELECT_JOURNALFEED_WHERE);
1633 }
1634 else {
1635 query.append(_FILTER_SQL_SELECT_JOURNALFEED_NO_INLINE_DISTINCT_WHERE_1);
1636 }
1637
1638 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1639
1640 if (!getDB().isSupportsInlineDistinct()) {
1641 query.append(_FILTER_SQL_SELECT_JOURNALFEED_NO_INLINE_DISTINCT_WHERE_2);
1642 }
1643
1644 if (orderByComparator != null) {
1645 if (getDB().isSupportsInlineDistinct()) {
1646 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1647 orderByComparator);
1648 }
1649 else {
1650 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
1651 orderByComparator);
1652 }
1653 }
1654
1655 else {
1656 if (getDB().isSupportsInlineDistinct()) {
1657 query.append(JournalFeedModelImpl.ORDER_BY_JPQL);
1658 }
1659 else {
1660 query.append(JournalFeedModelImpl.ORDER_BY_SQL);
1661 }
1662 }
1663
1664 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1665 JournalFeed.class.getName(),
1666 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
1667
1668 Session session = null;
1669
1670 try {
1671 session = openSession();
1672
1673 SQLQuery q = session.createSQLQuery(sql);
1674
1675 if (getDB().isSupportsInlineDistinct()) {
1676 q.addEntity(_FILTER_ENTITY_ALIAS, JournalFeedImpl.class);
1677 }
1678 else {
1679 q.addEntity(_FILTER_ENTITY_TABLE, JournalFeedImpl.class);
1680 }
1681
1682 QueryPos qPos = QueryPos.getInstance(q);
1683
1684 qPos.add(groupId);
1685
1686 return (List<JournalFeed>)QueryUtil.list(q, getDialect(), start, end);
1687 }
1688 catch (Exception e) {
1689 throw processException(e);
1690 }
1691 finally {
1692 closeSession(session);
1693 }
1694 }
1695
1696
1706 public JournalFeed[] filterFindByGroupId_PrevAndNext(long id, long groupId,
1707 OrderByComparator orderByComparator)
1708 throws NoSuchFeedException, SystemException {
1709 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1710 return findByGroupId_PrevAndNext(id, groupId, orderByComparator);
1711 }
1712
1713 JournalFeed journalFeed = findByPrimaryKey(id);
1714
1715 Session session = null;
1716
1717 try {
1718 session = openSession();
1719
1720 JournalFeed[] array = new JournalFeedImpl[3];
1721
1722 array[0] = filterGetByGroupId_PrevAndNext(session, journalFeed,
1723 groupId, orderByComparator, true);
1724
1725 array[1] = journalFeed;
1726
1727 array[2] = filterGetByGroupId_PrevAndNext(session, journalFeed,
1728 groupId, orderByComparator, false);
1729
1730 return array;
1731 }
1732 catch (Exception e) {
1733 throw processException(e);
1734 }
1735 finally {
1736 closeSession(session);
1737 }
1738 }
1739
1740 protected JournalFeed filterGetByGroupId_PrevAndNext(Session session,
1741 JournalFeed journalFeed, long groupId,
1742 OrderByComparator orderByComparator, boolean previous) {
1743 StringBundler query = null;
1744
1745 if (orderByComparator != null) {
1746 query = new StringBundler(6 +
1747 (orderByComparator.getOrderByFields().length * 6));
1748 }
1749 else {
1750 query = new StringBundler(3);
1751 }
1752
1753 if (getDB().isSupportsInlineDistinct()) {
1754 query.append(_FILTER_SQL_SELECT_JOURNALFEED_WHERE);
1755 }
1756 else {
1757 query.append(_FILTER_SQL_SELECT_JOURNALFEED_NO_INLINE_DISTINCT_WHERE_1);
1758 }
1759
1760 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1761
1762 if (!getDB().isSupportsInlineDistinct()) {
1763 query.append(_FILTER_SQL_SELECT_JOURNALFEED_NO_INLINE_DISTINCT_WHERE_2);
1764 }
1765
1766 if (orderByComparator != null) {
1767 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1768
1769 if (orderByConditionFields.length > 0) {
1770 query.append(WHERE_AND);
1771 }
1772
1773 for (int i = 0; i < orderByConditionFields.length; i++) {
1774 if (getDB().isSupportsInlineDistinct()) {
1775 query.append(_ORDER_BY_ENTITY_ALIAS);
1776 }
1777 else {
1778 query.append(_ORDER_BY_ENTITY_TABLE);
1779 }
1780
1781 query.append(orderByConditionFields[i]);
1782
1783 if ((i + 1) < orderByConditionFields.length) {
1784 if (orderByComparator.isAscending() ^ previous) {
1785 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1786 }
1787 else {
1788 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1789 }
1790 }
1791 else {
1792 if (orderByComparator.isAscending() ^ previous) {
1793 query.append(WHERE_GREATER_THAN);
1794 }
1795 else {
1796 query.append(WHERE_LESSER_THAN);
1797 }
1798 }
1799 }
1800
1801 query.append(ORDER_BY_CLAUSE);
1802
1803 String[] orderByFields = orderByComparator.getOrderByFields();
1804
1805 for (int i = 0; i < orderByFields.length; i++) {
1806 if (getDB().isSupportsInlineDistinct()) {
1807 query.append(_ORDER_BY_ENTITY_ALIAS);
1808 }
1809 else {
1810 query.append(_ORDER_BY_ENTITY_TABLE);
1811 }
1812
1813 query.append(orderByFields[i]);
1814
1815 if ((i + 1) < orderByFields.length) {
1816 if (orderByComparator.isAscending() ^ previous) {
1817 query.append(ORDER_BY_ASC_HAS_NEXT);
1818 }
1819 else {
1820 query.append(ORDER_BY_DESC_HAS_NEXT);
1821 }
1822 }
1823 else {
1824 if (orderByComparator.isAscending() ^ previous) {
1825 query.append(ORDER_BY_ASC);
1826 }
1827 else {
1828 query.append(ORDER_BY_DESC);
1829 }
1830 }
1831 }
1832 }
1833
1834 else {
1835 if (getDB().isSupportsInlineDistinct()) {
1836 query.append(JournalFeedModelImpl.ORDER_BY_JPQL);
1837 }
1838 else {
1839 query.append(JournalFeedModelImpl.ORDER_BY_SQL);
1840 }
1841 }
1842
1843 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1844 JournalFeed.class.getName(),
1845 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
1846
1847 SQLQuery q = session.createSQLQuery(sql);
1848
1849 q.setFirstResult(0);
1850 q.setMaxResults(2);
1851
1852 if (getDB().isSupportsInlineDistinct()) {
1853 q.addEntity(_FILTER_ENTITY_ALIAS, JournalFeedImpl.class);
1854 }
1855 else {
1856 q.addEntity(_FILTER_ENTITY_TABLE, JournalFeedImpl.class);
1857 }
1858
1859 QueryPos qPos = QueryPos.getInstance(q);
1860
1861 qPos.add(groupId);
1862
1863 if (orderByComparator != null) {
1864 Object[] values = orderByComparator.getOrderByConditionValues(journalFeed);
1865
1866 for (Object value : values) {
1867 qPos.add(value);
1868 }
1869 }
1870
1871 List<JournalFeed> list = q.list();
1872
1873 if (list.size() == 2) {
1874 return list.get(1);
1875 }
1876 else {
1877 return null;
1878 }
1879 }
1880
1881
1890 public JournalFeed findByG_F(long groupId, String feedId)
1891 throws NoSuchFeedException, SystemException {
1892 JournalFeed journalFeed = fetchByG_F(groupId, feedId);
1893
1894 if (journalFeed == null) {
1895 StringBundler msg = new StringBundler(6);
1896
1897 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1898
1899 msg.append("groupId=");
1900 msg.append(groupId);
1901
1902 msg.append(", feedId=");
1903 msg.append(feedId);
1904
1905 msg.append(StringPool.CLOSE_CURLY_BRACE);
1906
1907 if (_log.isWarnEnabled()) {
1908 _log.warn(msg.toString());
1909 }
1910
1911 throw new NoSuchFeedException(msg.toString());
1912 }
1913
1914 return journalFeed;
1915 }
1916
1917
1925 public JournalFeed fetchByG_F(long groupId, String feedId)
1926 throws SystemException {
1927 return fetchByG_F(groupId, feedId, true);
1928 }
1929
1930
1939 public JournalFeed fetchByG_F(long groupId, String feedId,
1940 boolean retrieveFromCache) throws SystemException {
1941 Object[] finderArgs = new Object[] { groupId, feedId };
1942
1943 Object result = null;
1944
1945 if (retrieveFromCache) {
1946 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_G_F,
1947 finderArgs, this);
1948 }
1949
1950 if (result instanceof JournalFeed) {
1951 JournalFeed journalFeed = (JournalFeed)result;
1952
1953 if ((groupId != journalFeed.getGroupId()) ||
1954 !Validator.equals(feedId, journalFeed.getFeedId())) {
1955 result = null;
1956 }
1957 }
1958
1959 if (result == null) {
1960 StringBundler query = new StringBundler(4);
1961
1962 query.append(_SQL_SELECT_JOURNALFEED_WHERE);
1963
1964 query.append(_FINDER_COLUMN_G_F_GROUPID_2);
1965
1966 if (feedId == null) {
1967 query.append(_FINDER_COLUMN_G_F_FEEDID_1);
1968 }
1969 else {
1970 if (feedId.equals(StringPool.BLANK)) {
1971 query.append(_FINDER_COLUMN_G_F_FEEDID_3);
1972 }
1973 else {
1974 query.append(_FINDER_COLUMN_G_F_FEEDID_2);
1975 }
1976 }
1977
1978 query.append(JournalFeedModelImpl.ORDER_BY_JPQL);
1979
1980 String sql = query.toString();
1981
1982 Session session = null;
1983
1984 try {
1985 session = openSession();
1986
1987 Query q = session.createQuery(sql);
1988
1989 QueryPos qPos = QueryPos.getInstance(q);
1990
1991 qPos.add(groupId);
1992
1993 if (feedId != null) {
1994 qPos.add(feedId);
1995 }
1996
1997 List<JournalFeed> list = q.list();
1998
1999 result = list;
2000
2001 JournalFeed journalFeed = null;
2002
2003 if (list.isEmpty()) {
2004 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_F,
2005 finderArgs, list);
2006 }
2007 else {
2008 journalFeed = list.get(0);
2009
2010 cacheResult(journalFeed);
2011
2012 if ((journalFeed.getGroupId() != groupId) ||
2013 (journalFeed.getFeedId() == null) ||
2014 !journalFeed.getFeedId().equals(feedId)) {
2015 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_G_F,
2016 finderArgs, journalFeed);
2017 }
2018 }
2019
2020 return journalFeed;
2021 }
2022 catch (Exception e) {
2023 throw processException(e);
2024 }
2025 finally {
2026 if (result == null) {
2027 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_G_F,
2028 finderArgs);
2029 }
2030
2031 closeSession(session);
2032 }
2033 }
2034 else {
2035 if (result instanceof List<?>) {
2036 return null;
2037 }
2038 else {
2039 return (JournalFeed)result;
2040 }
2041 }
2042 }
2043
2044
2050 public List<JournalFeed> findAll() throws SystemException {
2051 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2052 }
2053
2054
2066 public List<JournalFeed> findAll(int start, int end)
2067 throws SystemException {
2068 return findAll(start, end, null);
2069 }
2070
2071
2084 public List<JournalFeed> findAll(int start, int end,
2085 OrderByComparator orderByComparator) throws SystemException {
2086 FinderPath finderPath = null;
2087 Object[] finderArgs = new Object[] { start, end, orderByComparator };
2088
2089 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2090 (orderByComparator == null)) {
2091 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
2092 finderArgs = FINDER_ARGS_EMPTY;
2093 }
2094 else {
2095 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
2096 finderArgs = new Object[] { start, end, orderByComparator };
2097 }
2098
2099 List<JournalFeed> list = (List<JournalFeed>)FinderCacheUtil.getResult(finderPath,
2100 finderArgs, this);
2101
2102 if (list == null) {
2103 StringBundler query = null;
2104 String sql = null;
2105
2106 if (orderByComparator != null) {
2107 query = new StringBundler(2 +
2108 (orderByComparator.getOrderByFields().length * 3));
2109
2110 query.append(_SQL_SELECT_JOURNALFEED);
2111
2112 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2113 orderByComparator);
2114
2115 sql = query.toString();
2116 }
2117 else {
2118 sql = _SQL_SELECT_JOURNALFEED.concat(JournalFeedModelImpl.ORDER_BY_JPQL);
2119 }
2120
2121 Session session = null;
2122
2123 try {
2124 session = openSession();
2125
2126 Query q = session.createQuery(sql);
2127
2128 if (orderByComparator == null) {
2129 list = (List<JournalFeed>)QueryUtil.list(q, getDialect(),
2130 start, end, false);
2131
2132 Collections.sort(list);
2133 }
2134 else {
2135 list = (List<JournalFeed>)QueryUtil.list(q, getDialect(),
2136 start, end);
2137 }
2138 }
2139 catch (Exception e) {
2140 throw processException(e);
2141 }
2142 finally {
2143 if (list == null) {
2144 FinderCacheUtil.removeResult(finderPath, finderArgs);
2145 }
2146 else {
2147 cacheResult(list);
2148
2149 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2150 }
2151
2152 closeSession(session);
2153 }
2154 }
2155
2156 return list;
2157 }
2158
2159
2165 public void removeByUuid(String uuid) throws SystemException {
2166 for (JournalFeed journalFeed : findByUuid(uuid)) {
2167 remove(journalFeed);
2168 }
2169 }
2170
2171
2179 public JournalFeed removeByUUID_G(String uuid, long groupId)
2180 throws NoSuchFeedException, SystemException {
2181 JournalFeed journalFeed = findByUUID_G(uuid, groupId);
2182
2183 return remove(journalFeed);
2184 }
2185
2186
2192 public void removeByGroupId(long groupId) throws SystemException {
2193 for (JournalFeed journalFeed : findByGroupId(groupId)) {
2194 remove(journalFeed);
2195 }
2196 }
2197
2198
2206 public JournalFeed removeByG_F(long groupId, String feedId)
2207 throws NoSuchFeedException, SystemException {
2208 JournalFeed journalFeed = findByG_F(groupId, feedId);
2209
2210 return remove(journalFeed);
2211 }
2212
2213
2218 public void removeAll() throws SystemException {
2219 for (JournalFeed journalFeed : findAll()) {
2220 remove(journalFeed);
2221 }
2222 }
2223
2224
2231 public int countByUuid(String uuid) throws SystemException {
2232 Object[] finderArgs = new Object[] { uuid };
2233
2234 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
2235 finderArgs, this);
2236
2237 if (count == null) {
2238 StringBundler query = new StringBundler(2);
2239
2240 query.append(_SQL_COUNT_JOURNALFEED_WHERE);
2241
2242 if (uuid == null) {
2243 query.append(_FINDER_COLUMN_UUID_UUID_1);
2244 }
2245 else {
2246 if (uuid.equals(StringPool.BLANK)) {
2247 query.append(_FINDER_COLUMN_UUID_UUID_3);
2248 }
2249 else {
2250 query.append(_FINDER_COLUMN_UUID_UUID_2);
2251 }
2252 }
2253
2254 String sql = query.toString();
2255
2256 Session session = null;
2257
2258 try {
2259 session = openSession();
2260
2261 Query q = session.createQuery(sql);
2262
2263 QueryPos qPos = QueryPos.getInstance(q);
2264
2265 if (uuid != null) {
2266 qPos.add(uuid);
2267 }
2268
2269 count = (Long)q.uniqueResult();
2270 }
2271 catch (Exception e) {
2272 throw processException(e);
2273 }
2274 finally {
2275 if (count == null) {
2276 count = Long.valueOf(0);
2277 }
2278
2279 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
2280 finderArgs, count);
2281
2282 closeSession(session);
2283 }
2284 }
2285
2286 return count.intValue();
2287 }
2288
2289
2297 public int countByUUID_G(String uuid, long groupId)
2298 throws SystemException {
2299 Object[] finderArgs = new Object[] { uuid, groupId };
2300
2301 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID_G,
2302 finderArgs, this);
2303
2304 if (count == null) {
2305 StringBundler query = new StringBundler(3);
2306
2307 query.append(_SQL_COUNT_JOURNALFEED_WHERE);
2308
2309 if (uuid == null) {
2310 query.append(_FINDER_COLUMN_UUID_G_UUID_1);
2311 }
2312 else {
2313 if (uuid.equals(StringPool.BLANK)) {
2314 query.append(_FINDER_COLUMN_UUID_G_UUID_3);
2315 }
2316 else {
2317 query.append(_FINDER_COLUMN_UUID_G_UUID_2);
2318 }
2319 }
2320
2321 query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
2322
2323 String sql = query.toString();
2324
2325 Session session = null;
2326
2327 try {
2328 session = openSession();
2329
2330 Query q = session.createQuery(sql);
2331
2332 QueryPos qPos = QueryPos.getInstance(q);
2333
2334 if (uuid != null) {
2335 qPos.add(uuid);
2336 }
2337
2338 qPos.add(groupId);
2339
2340 count = (Long)q.uniqueResult();
2341 }
2342 catch (Exception e) {
2343 throw processException(e);
2344 }
2345 finally {
2346 if (count == null) {
2347 count = Long.valueOf(0);
2348 }
2349
2350 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID_G,
2351 finderArgs, count);
2352
2353 closeSession(session);
2354 }
2355 }
2356
2357 return count.intValue();
2358 }
2359
2360
2367 public int countByGroupId(long groupId) throws SystemException {
2368 Object[] finderArgs = new Object[] { groupId };
2369
2370 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
2371 finderArgs, this);
2372
2373 if (count == null) {
2374 StringBundler query = new StringBundler(2);
2375
2376 query.append(_SQL_COUNT_JOURNALFEED_WHERE);
2377
2378 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
2379
2380 String sql = query.toString();
2381
2382 Session session = null;
2383
2384 try {
2385 session = openSession();
2386
2387 Query q = session.createQuery(sql);
2388
2389 QueryPos qPos = QueryPos.getInstance(q);
2390
2391 qPos.add(groupId);
2392
2393 count = (Long)q.uniqueResult();
2394 }
2395 catch (Exception e) {
2396 throw processException(e);
2397 }
2398 finally {
2399 if (count == null) {
2400 count = Long.valueOf(0);
2401 }
2402
2403 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
2404 finderArgs, count);
2405
2406 closeSession(session);
2407 }
2408 }
2409
2410 return count.intValue();
2411 }
2412
2413
2420 public int filterCountByGroupId(long groupId) throws SystemException {
2421 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2422 return countByGroupId(groupId);
2423 }
2424
2425 StringBundler query = new StringBundler(2);
2426
2427 query.append(_FILTER_SQL_COUNT_JOURNALFEED_WHERE);
2428
2429 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
2430
2431 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2432 JournalFeed.class.getName(),
2433 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId);
2434
2435 Session session = null;
2436
2437 try {
2438 session = openSession();
2439
2440 SQLQuery q = session.createSQLQuery(sql);
2441
2442 q.addScalar(COUNT_COLUMN_NAME,
2443 com.liferay.portal.kernel.dao.orm.Type.LONG);
2444
2445 QueryPos qPos = QueryPos.getInstance(q);
2446
2447 qPos.add(groupId);
2448
2449 Long count = (Long)q.uniqueResult();
2450
2451 return count.intValue();
2452 }
2453 catch (Exception e) {
2454 throw processException(e);
2455 }
2456 finally {
2457 closeSession(session);
2458 }
2459 }
2460
2461
2469 public int countByG_F(long groupId, String feedId)
2470 throws SystemException {
2471 Object[] finderArgs = new Object[] { groupId, feedId };
2472
2473 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_F,
2474 finderArgs, this);
2475
2476 if (count == null) {
2477 StringBundler query = new StringBundler(3);
2478
2479 query.append(_SQL_COUNT_JOURNALFEED_WHERE);
2480
2481 query.append(_FINDER_COLUMN_G_F_GROUPID_2);
2482
2483 if (feedId == null) {
2484 query.append(_FINDER_COLUMN_G_F_FEEDID_1);
2485 }
2486 else {
2487 if (feedId.equals(StringPool.BLANK)) {
2488 query.append(_FINDER_COLUMN_G_F_FEEDID_3);
2489 }
2490 else {
2491 query.append(_FINDER_COLUMN_G_F_FEEDID_2);
2492 }
2493 }
2494
2495 String sql = query.toString();
2496
2497 Session session = null;
2498
2499 try {
2500 session = openSession();
2501
2502 Query q = session.createQuery(sql);
2503
2504 QueryPos qPos = QueryPos.getInstance(q);
2505
2506 qPos.add(groupId);
2507
2508 if (feedId != null) {
2509 qPos.add(feedId);
2510 }
2511
2512 count = (Long)q.uniqueResult();
2513 }
2514 catch (Exception e) {
2515 throw processException(e);
2516 }
2517 finally {
2518 if (count == null) {
2519 count = Long.valueOf(0);
2520 }
2521
2522 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_F, finderArgs,
2523 count);
2524
2525 closeSession(session);
2526 }
2527 }
2528
2529 return count.intValue();
2530 }
2531
2532
2538 public int countAll() throws SystemException {
2539 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
2540 FINDER_ARGS_EMPTY, this);
2541
2542 if (count == null) {
2543 Session session = null;
2544
2545 try {
2546 session = openSession();
2547
2548 Query q = session.createQuery(_SQL_COUNT_JOURNALFEED);
2549
2550 count = (Long)q.uniqueResult();
2551 }
2552 catch (Exception e) {
2553 throw processException(e);
2554 }
2555 finally {
2556 if (count == null) {
2557 count = Long.valueOf(0);
2558 }
2559
2560 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
2561 FINDER_ARGS_EMPTY, count);
2562
2563 closeSession(session);
2564 }
2565 }
2566
2567 return count.intValue();
2568 }
2569
2570
2573 public void afterPropertiesSet() {
2574 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
2575 com.liferay.portal.util.PropsUtil.get(
2576 "value.object.listener.com.liferay.portlet.journal.model.JournalFeed")));
2577
2578 if (listenerClassNames.length > 0) {
2579 try {
2580 List<ModelListener<JournalFeed>> listenersList = new ArrayList<ModelListener<JournalFeed>>();
2581
2582 for (String listenerClassName : listenerClassNames) {
2583 listenersList.add((ModelListener<JournalFeed>)InstanceFactory.newInstance(
2584 listenerClassName));
2585 }
2586
2587 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
2588 }
2589 catch (Exception e) {
2590 _log.error(e);
2591 }
2592 }
2593 }
2594
2595 public void destroy() {
2596 EntityCacheUtil.removeCache(JournalFeedImpl.class.getName());
2597 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
2598 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
2599 }
2600
2601 @BeanReference(type = JournalArticlePersistence.class)
2602 protected JournalArticlePersistence journalArticlePersistence;
2603 @BeanReference(type = JournalArticleImagePersistence.class)
2604 protected JournalArticleImagePersistence journalArticleImagePersistence;
2605 @BeanReference(type = JournalArticleResourcePersistence.class)
2606 protected JournalArticleResourcePersistence journalArticleResourcePersistence;
2607 @BeanReference(type = JournalContentSearchPersistence.class)
2608 protected JournalContentSearchPersistence journalContentSearchPersistence;
2609 @BeanReference(type = JournalFeedPersistence.class)
2610 protected JournalFeedPersistence journalFeedPersistence;
2611 @BeanReference(type = JournalStructurePersistence.class)
2612 protected JournalStructurePersistence journalStructurePersistence;
2613 @BeanReference(type = JournalTemplatePersistence.class)
2614 protected JournalTemplatePersistence journalTemplatePersistence;
2615 @BeanReference(type = ResourcePersistence.class)
2616 protected ResourcePersistence resourcePersistence;
2617 @BeanReference(type = UserPersistence.class)
2618 protected UserPersistence userPersistence;
2619 @BeanReference(type = ExpandoValuePersistence.class)
2620 protected ExpandoValuePersistence expandoValuePersistence;
2621 private static final String _SQL_SELECT_JOURNALFEED = "SELECT journalFeed FROM JournalFeed journalFeed";
2622 private static final String _SQL_SELECT_JOURNALFEED_WHERE = "SELECT journalFeed FROM JournalFeed journalFeed WHERE ";
2623 private static final String _SQL_COUNT_JOURNALFEED = "SELECT COUNT(journalFeed) FROM JournalFeed journalFeed";
2624 private static final String _SQL_COUNT_JOURNALFEED_WHERE = "SELECT COUNT(journalFeed) FROM JournalFeed journalFeed WHERE ";
2625 private static final String _FINDER_COLUMN_UUID_UUID_1 = "journalFeed.uuid IS NULL";
2626 private static final String _FINDER_COLUMN_UUID_UUID_2 = "journalFeed.uuid = ?";
2627 private static final String _FINDER_COLUMN_UUID_UUID_3 = "(journalFeed.uuid IS NULL OR journalFeed.uuid = ?)";
2628 private static final String _FINDER_COLUMN_UUID_G_UUID_1 = "journalFeed.uuid IS NULL AND ";
2629 private static final String _FINDER_COLUMN_UUID_G_UUID_2 = "journalFeed.uuid = ? AND ";
2630 private static final String _FINDER_COLUMN_UUID_G_UUID_3 = "(journalFeed.uuid IS NULL OR journalFeed.uuid = ?) AND ";
2631 private static final String _FINDER_COLUMN_UUID_G_GROUPID_2 = "journalFeed.groupId = ?";
2632 private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "journalFeed.groupId = ?";
2633 private static final String _FINDER_COLUMN_G_F_GROUPID_2 = "journalFeed.groupId = ? AND ";
2634 private static final String _FINDER_COLUMN_G_F_FEEDID_1 = "journalFeed.feedId IS NULL";
2635 private static final String _FINDER_COLUMN_G_F_FEEDID_2 = "journalFeed.feedId = ?";
2636 private static final String _FINDER_COLUMN_G_F_FEEDID_3 = "(journalFeed.feedId IS NULL OR journalFeed.feedId = ?)";
2637 private static final String _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN = "journalFeed.id_";
2638 private static final String _FILTER_SQL_SELECT_JOURNALFEED_WHERE = "SELECT DISTINCT {journalFeed.*} FROM JournalFeed journalFeed WHERE ";
2639 private static final String _FILTER_SQL_SELECT_JOURNALFEED_NO_INLINE_DISTINCT_WHERE_1 =
2640 "SELECT {JournalFeed.*} FROM (SELECT DISTINCT journalFeed.id_ FROM JournalFeed journalFeed WHERE ";
2641 private static final String _FILTER_SQL_SELECT_JOURNALFEED_NO_INLINE_DISTINCT_WHERE_2 =
2642 ") TEMP_TABLE INNER JOIN JournalFeed ON TEMP_TABLE.id_ = JournalFeed.id_";
2643 private static final String _FILTER_SQL_COUNT_JOURNALFEED_WHERE = "SELECT COUNT(DISTINCT journalFeed.id_) AS COUNT_VALUE FROM JournalFeed journalFeed WHERE ";
2644 private static final String _FILTER_ENTITY_ALIAS = "journalFeed";
2645 private static final String _FILTER_ENTITY_TABLE = "JournalFeed";
2646 private static final String _ORDER_BY_ENTITY_ALIAS = "journalFeed.";
2647 private static final String _ORDER_BY_ENTITY_TABLE = "JournalFeed.";
2648 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No JournalFeed exists with the primary key ";
2649 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No JournalFeed exists with the key {";
2650 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
2651 private static Log _log = LogFactoryUtil.getLog(JournalFeedPersistenceImpl.class);
2652 private static JournalFeed _nullJournalFeed = new JournalFeedImpl() {
2653 @Override
2654 public Object clone() {
2655 return this;
2656 }
2657
2658 @Override
2659 public CacheModel<JournalFeed> toCacheModel() {
2660 return _nullJournalFeedCacheModel;
2661 }
2662 };
2663
2664 private static CacheModel<JournalFeed> _nullJournalFeedCacheModel = new CacheModel<JournalFeed>() {
2665 public JournalFeed toEntityModel() {
2666 return _nullJournalFeed;
2667 }
2668 };
2669 }