001
014
015 package com.liferay.portlet.announcements.service.persistence.impl;
016
017 import aQute.bnd.annotation.ProviderType;
018
019 import com.liferay.portal.kernel.dao.orm.EntityCache;
020 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
021 import com.liferay.portal.kernel.dao.orm.FinderCache;
022 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
023 import com.liferay.portal.kernel.dao.orm.FinderPath;
024 import com.liferay.portal.kernel.dao.orm.Query;
025 import com.liferay.portal.kernel.dao.orm.QueryPos;
026 import com.liferay.portal.kernel.dao.orm.QueryUtil;
027 import com.liferay.portal.kernel.dao.orm.SQLQuery;
028 import com.liferay.portal.kernel.dao.orm.Session;
029 import com.liferay.portal.kernel.exception.SystemException;
030 import com.liferay.portal.kernel.log.Log;
031 import com.liferay.portal.kernel.log.LogFactoryUtil;
032 import com.liferay.portal.kernel.sanitizer.Sanitizer;
033 import com.liferay.portal.kernel.sanitizer.SanitizerException;
034 import com.liferay.portal.kernel.sanitizer.SanitizerUtil;
035 import com.liferay.portal.kernel.util.ContentTypes;
036 import com.liferay.portal.kernel.util.GetterUtil;
037 import com.liferay.portal.kernel.util.OrderByComparator;
038 import com.liferay.portal.kernel.util.SetUtil;
039 import com.liferay.portal.kernel.util.StringBundler;
040 import com.liferay.portal.kernel.util.StringPool;
041 import com.liferay.portal.kernel.util.Validator;
042 import com.liferay.portal.kernel.uuid.PortalUUIDUtil;
043 import com.liferay.portal.model.CacheModel;
044 import com.liferay.portal.security.auth.PrincipalThreadLocal;
045 import com.liferay.portal.security.permission.InlineSQLHelperUtil;
046 import com.liferay.portal.service.ServiceContext;
047 import com.liferay.portal.service.ServiceContextThreadLocal;
048 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
049
050 import com.liferay.portlet.announcements.NoSuchEntryException;
051 import com.liferay.portlet.announcements.model.AnnouncementsEntry;
052 import com.liferay.portlet.announcements.model.impl.AnnouncementsEntryImpl;
053 import com.liferay.portlet.announcements.model.impl.AnnouncementsEntryModelImpl;
054 import com.liferay.portlet.announcements.service.persistence.AnnouncementsEntryPersistence;
055
056 import java.io.Serializable;
057
058 import java.util.Collections;
059 import java.util.Date;
060 import java.util.HashMap;
061 import java.util.HashSet;
062 import java.util.Iterator;
063 import java.util.List;
064 import java.util.Map;
065 import java.util.Set;
066
067
079 @ProviderType
080 public class AnnouncementsEntryPersistenceImpl extends BasePersistenceImpl<AnnouncementsEntry>
081 implements AnnouncementsEntryPersistence {
082
087 public static final String FINDER_CLASS_NAME_ENTITY = AnnouncementsEntryImpl.class.getName();
088 public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
089 ".List1";
090 public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
091 ".List2";
092 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
093 AnnouncementsEntryModelImpl.FINDER_CACHE_ENABLED,
094 AnnouncementsEntryImpl.class,
095 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
096 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
097 AnnouncementsEntryModelImpl.FINDER_CACHE_ENABLED,
098 AnnouncementsEntryImpl.class,
099 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
100 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
101 AnnouncementsEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
102 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
103 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_UUID = new FinderPath(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
104 AnnouncementsEntryModelImpl.FINDER_CACHE_ENABLED,
105 AnnouncementsEntryImpl.class,
106 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByUuid",
107 new String[] {
108 String.class.getName(),
109
110 Integer.class.getName(), Integer.class.getName(),
111 OrderByComparator.class.getName()
112 });
113 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID = new FinderPath(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
114 AnnouncementsEntryModelImpl.FINDER_CACHE_ENABLED,
115 AnnouncementsEntryImpl.class,
116 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByUuid",
117 new String[] { String.class.getName() },
118 AnnouncementsEntryModelImpl.UUID_COLUMN_BITMASK |
119 AnnouncementsEntryModelImpl.PRIORITY_COLUMN_BITMASK |
120 AnnouncementsEntryModelImpl.MODIFIEDDATE_COLUMN_BITMASK);
121 public static final FinderPath FINDER_PATH_COUNT_BY_UUID = new FinderPath(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
122 AnnouncementsEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
123 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUuid",
124 new String[] { String.class.getName() });
125
126
132 @Override
133 public List<AnnouncementsEntry> findByUuid(String uuid) {
134 return findByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
135 }
136
137
149 @Override
150 public List<AnnouncementsEntry> findByUuid(String uuid, int start, int end) {
151 return findByUuid(uuid, start, end, null);
152 }
153
154
167 @Override
168 public List<AnnouncementsEntry> findByUuid(String uuid, int start, int end,
169 OrderByComparator<AnnouncementsEntry> orderByComparator) {
170 return findByUuid(uuid, start, end, orderByComparator, true);
171 }
172
173
187 @Override
188 public List<AnnouncementsEntry> findByUuid(String uuid, int start, int end,
189 OrderByComparator<AnnouncementsEntry> orderByComparator,
190 boolean retrieveFromCache) {
191 boolean pagination = true;
192 FinderPath finderPath = null;
193 Object[] finderArgs = null;
194
195 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
196 (orderByComparator == null)) {
197 pagination = false;
198 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID;
199 finderArgs = new Object[] { uuid };
200 }
201 else {
202 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_UUID;
203 finderArgs = new Object[] { uuid, start, end, orderByComparator };
204 }
205
206 List<AnnouncementsEntry> list = null;
207
208 if (retrieveFromCache) {
209 list = (List<AnnouncementsEntry>)finderCache.getResult(finderPath,
210 finderArgs, this);
211
212 if ((list != null) && !list.isEmpty()) {
213 for (AnnouncementsEntry announcementsEntry : list) {
214 if (!Validator.equals(uuid, announcementsEntry.getUuid())) {
215 list = null;
216
217 break;
218 }
219 }
220 }
221 }
222
223 if (list == null) {
224 StringBundler query = null;
225
226 if (orderByComparator != null) {
227 query = new StringBundler(3 +
228 (orderByComparator.getOrderByFields().length * 3));
229 }
230 else {
231 query = new StringBundler(3);
232 }
233
234 query.append(_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
235
236 boolean bindUuid = false;
237
238 if (uuid == null) {
239 query.append(_FINDER_COLUMN_UUID_UUID_1);
240 }
241 else if (uuid.equals(StringPool.BLANK)) {
242 query.append(_FINDER_COLUMN_UUID_UUID_3);
243 }
244 else {
245 bindUuid = true;
246
247 query.append(_FINDER_COLUMN_UUID_UUID_2);
248 }
249
250 if (orderByComparator != null) {
251 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
252 orderByComparator);
253 }
254 else
255 if (pagination) {
256 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
257 }
258
259 String sql = query.toString();
260
261 Session session = null;
262
263 try {
264 session = openSession();
265
266 Query q = session.createQuery(sql);
267
268 QueryPos qPos = QueryPos.getInstance(q);
269
270 if (bindUuid) {
271 qPos.add(uuid);
272 }
273
274 if (!pagination) {
275 list = (List<AnnouncementsEntry>)QueryUtil.list(q,
276 getDialect(), start, end, false);
277
278 Collections.sort(list);
279
280 list = Collections.unmodifiableList(list);
281 }
282 else {
283 list = (List<AnnouncementsEntry>)QueryUtil.list(q,
284 getDialect(), start, end);
285 }
286
287 cacheResult(list);
288
289 finderCache.putResult(finderPath, finderArgs, list);
290 }
291 catch (Exception e) {
292 finderCache.removeResult(finderPath, finderArgs);
293
294 throw processException(e);
295 }
296 finally {
297 closeSession(session);
298 }
299 }
300
301 return list;
302 }
303
304
312 @Override
313 public AnnouncementsEntry findByUuid_First(String uuid,
314 OrderByComparator<AnnouncementsEntry> orderByComparator)
315 throws NoSuchEntryException {
316 AnnouncementsEntry announcementsEntry = fetchByUuid_First(uuid,
317 orderByComparator);
318
319 if (announcementsEntry != null) {
320 return announcementsEntry;
321 }
322
323 StringBundler msg = new StringBundler(4);
324
325 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
326
327 msg.append("uuid=");
328 msg.append(uuid);
329
330 msg.append(StringPool.CLOSE_CURLY_BRACE);
331
332 throw new NoSuchEntryException(msg.toString());
333 }
334
335
342 @Override
343 public AnnouncementsEntry fetchByUuid_First(String uuid,
344 OrderByComparator<AnnouncementsEntry> orderByComparator) {
345 List<AnnouncementsEntry> list = findByUuid(uuid, 0, 1, orderByComparator);
346
347 if (!list.isEmpty()) {
348 return list.get(0);
349 }
350
351 return null;
352 }
353
354
362 @Override
363 public AnnouncementsEntry findByUuid_Last(String uuid,
364 OrderByComparator<AnnouncementsEntry> orderByComparator)
365 throws NoSuchEntryException {
366 AnnouncementsEntry announcementsEntry = fetchByUuid_Last(uuid,
367 orderByComparator);
368
369 if (announcementsEntry != null) {
370 return announcementsEntry;
371 }
372
373 StringBundler msg = new StringBundler(4);
374
375 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
376
377 msg.append("uuid=");
378 msg.append(uuid);
379
380 msg.append(StringPool.CLOSE_CURLY_BRACE);
381
382 throw new NoSuchEntryException(msg.toString());
383 }
384
385
392 @Override
393 public AnnouncementsEntry fetchByUuid_Last(String uuid,
394 OrderByComparator<AnnouncementsEntry> orderByComparator) {
395 int count = countByUuid(uuid);
396
397 if (count == 0) {
398 return null;
399 }
400
401 List<AnnouncementsEntry> list = findByUuid(uuid, count - 1, count,
402 orderByComparator);
403
404 if (!list.isEmpty()) {
405 return list.get(0);
406 }
407
408 return null;
409 }
410
411
420 @Override
421 public AnnouncementsEntry[] findByUuid_PrevAndNext(long entryId,
422 String uuid, OrderByComparator<AnnouncementsEntry> orderByComparator)
423 throws NoSuchEntryException {
424 AnnouncementsEntry announcementsEntry = findByPrimaryKey(entryId);
425
426 Session session = null;
427
428 try {
429 session = openSession();
430
431 AnnouncementsEntry[] array = new AnnouncementsEntryImpl[3];
432
433 array[0] = getByUuid_PrevAndNext(session, announcementsEntry, uuid,
434 orderByComparator, true);
435
436 array[1] = announcementsEntry;
437
438 array[2] = getByUuid_PrevAndNext(session, announcementsEntry, uuid,
439 orderByComparator, false);
440
441 return array;
442 }
443 catch (Exception e) {
444 throw processException(e);
445 }
446 finally {
447 closeSession(session);
448 }
449 }
450
451 protected AnnouncementsEntry getByUuid_PrevAndNext(Session session,
452 AnnouncementsEntry announcementsEntry, String uuid,
453 OrderByComparator<AnnouncementsEntry> orderByComparator,
454 boolean previous) {
455 StringBundler query = null;
456
457 if (orderByComparator != null) {
458 query = new StringBundler(6 +
459 (orderByComparator.getOrderByFields().length * 6));
460 }
461 else {
462 query = new StringBundler(3);
463 }
464
465 query.append(_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
466
467 boolean bindUuid = false;
468
469 if (uuid == null) {
470 query.append(_FINDER_COLUMN_UUID_UUID_1);
471 }
472 else if (uuid.equals(StringPool.BLANK)) {
473 query.append(_FINDER_COLUMN_UUID_UUID_3);
474 }
475 else {
476 bindUuid = true;
477
478 query.append(_FINDER_COLUMN_UUID_UUID_2);
479 }
480
481 if (orderByComparator != null) {
482 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
483
484 if (orderByConditionFields.length > 0) {
485 query.append(WHERE_AND);
486 }
487
488 for (int i = 0; i < orderByConditionFields.length; i++) {
489 query.append(_ORDER_BY_ENTITY_ALIAS);
490 query.append(orderByConditionFields[i]);
491
492 if ((i + 1) < orderByConditionFields.length) {
493 if (orderByComparator.isAscending() ^ previous) {
494 query.append(WHERE_GREATER_THAN_HAS_NEXT);
495 }
496 else {
497 query.append(WHERE_LESSER_THAN_HAS_NEXT);
498 }
499 }
500 else {
501 if (orderByComparator.isAscending() ^ previous) {
502 query.append(WHERE_GREATER_THAN);
503 }
504 else {
505 query.append(WHERE_LESSER_THAN);
506 }
507 }
508 }
509
510 query.append(ORDER_BY_CLAUSE);
511
512 String[] orderByFields = orderByComparator.getOrderByFields();
513
514 for (int i = 0; i < orderByFields.length; i++) {
515 query.append(_ORDER_BY_ENTITY_ALIAS);
516 query.append(orderByFields[i]);
517
518 if ((i + 1) < orderByFields.length) {
519 if (orderByComparator.isAscending() ^ previous) {
520 query.append(ORDER_BY_ASC_HAS_NEXT);
521 }
522 else {
523 query.append(ORDER_BY_DESC_HAS_NEXT);
524 }
525 }
526 else {
527 if (orderByComparator.isAscending() ^ previous) {
528 query.append(ORDER_BY_ASC);
529 }
530 else {
531 query.append(ORDER_BY_DESC);
532 }
533 }
534 }
535 }
536 else {
537 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
538 }
539
540 String sql = query.toString();
541
542 Query q = session.createQuery(sql);
543
544 q.setFirstResult(0);
545 q.setMaxResults(2);
546
547 QueryPos qPos = QueryPos.getInstance(q);
548
549 if (bindUuid) {
550 qPos.add(uuid);
551 }
552
553 if (orderByComparator != null) {
554 Object[] values = orderByComparator.getOrderByConditionValues(announcementsEntry);
555
556 for (Object value : values) {
557 qPos.add(value);
558 }
559 }
560
561 List<AnnouncementsEntry> list = q.list();
562
563 if (list.size() == 2) {
564 return list.get(1);
565 }
566 else {
567 return null;
568 }
569 }
570
571
577 @Override
578 public List<AnnouncementsEntry> filterFindByUuid(String uuid) {
579 return filterFindByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
580 }
581
582
594 @Override
595 public List<AnnouncementsEntry> filterFindByUuid(String uuid, int start,
596 int end) {
597 return filterFindByUuid(uuid, start, end, null);
598 }
599
600
613 @Override
614 public List<AnnouncementsEntry> filterFindByUuid(String uuid, int start,
615 int end, OrderByComparator<AnnouncementsEntry> orderByComparator) {
616 if (!InlineSQLHelperUtil.isEnabled()) {
617 return findByUuid(uuid, start, end, orderByComparator);
618 }
619
620 StringBundler query = null;
621
622 if (orderByComparator != null) {
623 query = new StringBundler(3 +
624 (orderByComparator.getOrderByFields().length * 3));
625 }
626 else {
627 query = new StringBundler(3);
628 }
629
630 if (getDB().isSupportsInlineDistinct()) {
631 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
632 }
633 else {
634 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_1);
635 }
636
637 boolean bindUuid = false;
638
639 if (uuid == null) {
640 query.append(_FINDER_COLUMN_UUID_UUID_1_SQL);
641 }
642 else if (uuid.equals(StringPool.BLANK)) {
643 query.append(_FINDER_COLUMN_UUID_UUID_3_SQL);
644 }
645 else {
646 bindUuid = true;
647
648 query.append(_FINDER_COLUMN_UUID_UUID_2_SQL);
649 }
650
651 if (!getDB().isSupportsInlineDistinct()) {
652 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_2);
653 }
654
655 if (orderByComparator != null) {
656 if (getDB().isSupportsInlineDistinct()) {
657 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
658 orderByComparator, true);
659 }
660 else {
661 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
662 orderByComparator, true);
663 }
664 }
665 else {
666 if (getDB().isSupportsInlineDistinct()) {
667 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
668 }
669 else {
670 query.append(AnnouncementsEntryModelImpl.ORDER_BY_SQL);
671 }
672 }
673
674 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
675 AnnouncementsEntry.class.getName(),
676 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
677
678 Session session = null;
679
680 try {
681 session = openSession();
682
683 SQLQuery q = session.createSynchronizedSQLQuery(sql);
684
685 if (getDB().isSupportsInlineDistinct()) {
686 q.addEntity(_FILTER_ENTITY_ALIAS, AnnouncementsEntryImpl.class);
687 }
688 else {
689 q.addEntity(_FILTER_ENTITY_TABLE, AnnouncementsEntryImpl.class);
690 }
691
692 QueryPos qPos = QueryPos.getInstance(q);
693
694 if (bindUuid) {
695 qPos.add(uuid);
696 }
697
698 return (List<AnnouncementsEntry>)QueryUtil.list(q, getDialect(),
699 start, end);
700 }
701 catch (Exception e) {
702 throw processException(e);
703 }
704 finally {
705 closeSession(session);
706 }
707 }
708
709
718 @Override
719 public AnnouncementsEntry[] filterFindByUuid_PrevAndNext(long entryId,
720 String uuid, OrderByComparator<AnnouncementsEntry> orderByComparator)
721 throws NoSuchEntryException {
722 if (!InlineSQLHelperUtil.isEnabled()) {
723 return findByUuid_PrevAndNext(entryId, uuid, orderByComparator);
724 }
725
726 AnnouncementsEntry announcementsEntry = findByPrimaryKey(entryId);
727
728 Session session = null;
729
730 try {
731 session = openSession();
732
733 AnnouncementsEntry[] array = new AnnouncementsEntryImpl[3];
734
735 array[0] = filterGetByUuid_PrevAndNext(session, announcementsEntry,
736 uuid, orderByComparator, true);
737
738 array[1] = announcementsEntry;
739
740 array[2] = filterGetByUuid_PrevAndNext(session, announcementsEntry,
741 uuid, orderByComparator, false);
742
743 return array;
744 }
745 catch (Exception e) {
746 throw processException(e);
747 }
748 finally {
749 closeSession(session);
750 }
751 }
752
753 protected AnnouncementsEntry filterGetByUuid_PrevAndNext(Session session,
754 AnnouncementsEntry announcementsEntry, String uuid,
755 OrderByComparator<AnnouncementsEntry> orderByComparator,
756 boolean previous) {
757 StringBundler query = null;
758
759 if (orderByComparator != null) {
760 query = new StringBundler(6 +
761 (orderByComparator.getOrderByFields().length * 6));
762 }
763 else {
764 query = new StringBundler(3);
765 }
766
767 if (getDB().isSupportsInlineDistinct()) {
768 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
769 }
770 else {
771 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_1);
772 }
773
774 boolean bindUuid = false;
775
776 if (uuid == null) {
777 query.append(_FINDER_COLUMN_UUID_UUID_1_SQL);
778 }
779 else if (uuid.equals(StringPool.BLANK)) {
780 query.append(_FINDER_COLUMN_UUID_UUID_3_SQL);
781 }
782 else {
783 bindUuid = true;
784
785 query.append(_FINDER_COLUMN_UUID_UUID_2_SQL);
786 }
787
788 if (!getDB().isSupportsInlineDistinct()) {
789 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_2);
790 }
791
792 if (orderByComparator != null) {
793 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
794
795 if (orderByConditionFields.length > 0) {
796 query.append(WHERE_AND);
797 }
798
799 for (int i = 0; i < orderByConditionFields.length; i++) {
800 if (getDB().isSupportsInlineDistinct()) {
801 query.append(_ORDER_BY_ENTITY_ALIAS);
802 }
803 else {
804 query.append(_ORDER_BY_ENTITY_TABLE);
805 }
806
807 query.append(orderByConditionFields[i]);
808
809 if ((i + 1) < orderByConditionFields.length) {
810 if (orderByComparator.isAscending() ^ previous) {
811 query.append(WHERE_GREATER_THAN_HAS_NEXT);
812 }
813 else {
814 query.append(WHERE_LESSER_THAN_HAS_NEXT);
815 }
816 }
817 else {
818 if (orderByComparator.isAscending() ^ previous) {
819 query.append(WHERE_GREATER_THAN);
820 }
821 else {
822 query.append(WHERE_LESSER_THAN);
823 }
824 }
825 }
826
827 query.append(ORDER_BY_CLAUSE);
828
829 String[] orderByFields = orderByComparator.getOrderByFields();
830
831 for (int i = 0; i < orderByFields.length; i++) {
832 if (getDB().isSupportsInlineDistinct()) {
833 query.append(_ORDER_BY_ENTITY_ALIAS);
834 }
835 else {
836 query.append(_ORDER_BY_ENTITY_TABLE);
837 }
838
839 query.append(orderByFields[i]);
840
841 if ((i + 1) < orderByFields.length) {
842 if (orderByComparator.isAscending() ^ previous) {
843 query.append(ORDER_BY_ASC_HAS_NEXT);
844 }
845 else {
846 query.append(ORDER_BY_DESC_HAS_NEXT);
847 }
848 }
849 else {
850 if (orderByComparator.isAscending() ^ previous) {
851 query.append(ORDER_BY_ASC);
852 }
853 else {
854 query.append(ORDER_BY_DESC);
855 }
856 }
857 }
858 }
859 else {
860 if (getDB().isSupportsInlineDistinct()) {
861 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
862 }
863 else {
864 query.append(AnnouncementsEntryModelImpl.ORDER_BY_SQL);
865 }
866 }
867
868 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
869 AnnouncementsEntry.class.getName(),
870 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
871
872 SQLQuery q = session.createSynchronizedSQLQuery(sql);
873
874 q.setFirstResult(0);
875 q.setMaxResults(2);
876
877 if (getDB().isSupportsInlineDistinct()) {
878 q.addEntity(_FILTER_ENTITY_ALIAS, AnnouncementsEntryImpl.class);
879 }
880 else {
881 q.addEntity(_FILTER_ENTITY_TABLE, AnnouncementsEntryImpl.class);
882 }
883
884 QueryPos qPos = QueryPos.getInstance(q);
885
886 if (bindUuid) {
887 qPos.add(uuid);
888 }
889
890 if (orderByComparator != null) {
891 Object[] values = orderByComparator.getOrderByConditionValues(announcementsEntry);
892
893 for (Object value : values) {
894 qPos.add(value);
895 }
896 }
897
898 List<AnnouncementsEntry> list = q.list();
899
900 if (list.size() == 2) {
901 return list.get(1);
902 }
903 else {
904 return null;
905 }
906 }
907
908
913 @Override
914 public void removeByUuid(String uuid) {
915 for (AnnouncementsEntry announcementsEntry : findByUuid(uuid,
916 QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
917 remove(announcementsEntry);
918 }
919 }
920
921
927 @Override
928 public int countByUuid(String uuid) {
929 FinderPath finderPath = FINDER_PATH_COUNT_BY_UUID;
930
931 Object[] finderArgs = new Object[] { uuid };
932
933 Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);
934
935 if (count == null) {
936 StringBundler query = new StringBundler(2);
937
938 query.append(_SQL_COUNT_ANNOUNCEMENTSENTRY_WHERE);
939
940 boolean bindUuid = false;
941
942 if (uuid == null) {
943 query.append(_FINDER_COLUMN_UUID_UUID_1);
944 }
945 else if (uuid.equals(StringPool.BLANK)) {
946 query.append(_FINDER_COLUMN_UUID_UUID_3);
947 }
948 else {
949 bindUuid = true;
950
951 query.append(_FINDER_COLUMN_UUID_UUID_2);
952 }
953
954 String sql = query.toString();
955
956 Session session = null;
957
958 try {
959 session = openSession();
960
961 Query q = session.createQuery(sql);
962
963 QueryPos qPos = QueryPos.getInstance(q);
964
965 if (bindUuid) {
966 qPos.add(uuid);
967 }
968
969 count = (Long)q.uniqueResult();
970
971 finderCache.putResult(finderPath, finderArgs, count);
972 }
973 catch (Exception e) {
974 finderCache.removeResult(finderPath, finderArgs);
975
976 throw processException(e);
977 }
978 finally {
979 closeSession(session);
980 }
981 }
982
983 return count.intValue();
984 }
985
986
992 @Override
993 public int filterCountByUuid(String uuid) {
994 if (!InlineSQLHelperUtil.isEnabled()) {
995 return countByUuid(uuid);
996 }
997
998 StringBundler query = new StringBundler(2);
999
1000 query.append(_FILTER_SQL_COUNT_ANNOUNCEMENTSENTRY_WHERE);
1001
1002 boolean bindUuid = false;
1003
1004 if (uuid == null) {
1005 query.append(_FINDER_COLUMN_UUID_UUID_1_SQL);
1006 }
1007 else if (uuid.equals(StringPool.BLANK)) {
1008 query.append(_FINDER_COLUMN_UUID_UUID_3_SQL);
1009 }
1010 else {
1011 bindUuid = true;
1012
1013 query.append(_FINDER_COLUMN_UUID_UUID_2_SQL);
1014 }
1015
1016 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1017 AnnouncementsEntry.class.getName(),
1018 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
1019
1020 Session session = null;
1021
1022 try {
1023 session = openSession();
1024
1025 SQLQuery q = session.createSynchronizedSQLQuery(sql);
1026
1027 q.addScalar(COUNT_COLUMN_NAME,
1028 com.liferay.portal.kernel.dao.orm.Type.LONG);
1029
1030 QueryPos qPos = QueryPos.getInstance(q);
1031
1032 if (bindUuid) {
1033 qPos.add(uuid);
1034 }
1035
1036 Long count = (Long)q.uniqueResult();
1037
1038 return count.intValue();
1039 }
1040 catch (Exception e) {
1041 throw processException(e);
1042 }
1043 finally {
1044 closeSession(session);
1045 }
1046 }
1047
1048 private static final String _FINDER_COLUMN_UUID_UUID_1 = "announcementsEntry.uuid IS NULL";
1049 private static final String _FINDER_COLUMN_UUID_UUID_2 = "announcementsEntry.uuid = ?";
1050 private static final String _FINDER_COLUMN_UUID_UUID_3 = "(announcementsEntry.uuid IS NULL OR announcementsEntry.uuid = '')";
1051 private static final String _FINDER_COLUMN_UUID_UUID_1_SQL = "announcementsEntry.uuid_ IS NULL";
1052 private static final String _FINDER_COLUMN_UUID_UUID_2_SQL = "announcementsEntry.uuid_ = ?";
1053 private static final String _FINDER_COLUMN_UUID_UUID_3_SQL = "(announcementsEntry.uuid_ IS NULL OR announcementsEntry.uuid_ = '')";
1054 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_UUID_C = new FinderPath(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
1055 AnnouncementsEntryModelImpl.FINDER_CACHE_ENABLED,
1056 AnnouncementsEntryImpl.class,
1057 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByUuid_C",
1058 new String[] {
1059 String.class.getName(), Long.class.getName(),
1060
1061 Integer.class.getName(), Integer.class.getName(),
1062 OrderByComparator.class.getName()
1063 });
1064 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID_C =
1065 new FinderPath(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
1066 AnnouncementsEntryModelImpl.FINDER_CACHE_ENABLED,
1067 AnnouncementsEntryImpl.class,
1068 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByUuid_C",
1069 new String[] { String.class.getName(), Long.class.getName() },
1070 AnnouncementsEntryModelImpl.UUID_COLUMN_BITMASK |
1071 AnnouncementsEntryModelImpl.COMPANYID_COLUMN_BITMASK |
1072 AnnouncementsEntryModelImpl.PRIORITY_COLUMN_BITMASK |
1073 AnnouncementsEntryModelImpl.MODIFIEDDATE_COLUMN_BITMASK);
1074 public static final FinderPath FINDER_PATH_COUNT_BY_UUID_C = new FinderPath(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
1075 AnnouncementsEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
1076 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUuid_C",
1077 new String[] { String.class.getName(), Long.class.getName() });
1078
1079
1086 @Override
1087 public List<AnnouncementsEntry> findByUuid_C(String uuid, long companyId) {
1088 return findByUuid_C(uuid, companyId, QueryUtil.ALL_POS,
1089 QueryUtil.ALL_POS, null);
1090 }
1091
1092
1105 @Override
1106 public List<AnnouncementsEntry> findByUuid_C(String uuid, long companyId,
1107 int start, int end) {
1108 return findByUuid_C(uuid, companyId, start, end, null);
1109 }
1110
1111
1125 @Override
1126 public List<AnnouncementsEntry> findByUuid_C(String uuid, long companyId,
1127 int start, int end,
1128 OrderByComparator<AnnouncementsEntry> orderByComparator) {
1129 return findByUuid_C(uuid, companyId, start, end, orderByComparator, true);
1130 }
1131
1132
1147 @Override
1148 public List<AnnouncementsEntry> findByUuid_C(String uuid, long companyId,
1149 int start, int end,
1150 OrderByComparator<AnnouncementsEntry> orderByComparator,
1151 boolean retrieveFromCache) {
1152 boolean pagination = true;
1153 FinderPath finderPath = null;
1154 Object[] finderArgs = null;
1155
1156 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1157 (orderByComparator == null)) {
1158 pagination = false;
1159 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID_C;
1160 finderArgs = new Object[] { uuid, companyId };
1161 }
1162 else {
1163 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_UUID_C;
1164 finderArgs = new Object[] {
1165 uuid, companyId,
1166
1167 start, end, orderByComparator
1168 };
1169 }
1170
1171 List<AnnouncementsEntry> list = null;
1172
1173 if (retrieveFromCache) {
1174 list = (List<AnnouncementsEntry>)finderCache.getResult(finderPath,
1175 finderArgs, this);
1176
1177 if ((list != null) && !list.isEmpty()) {
1178 for (AnnouncementsEntry announcementsEntry : list) {
1179 if (!Validator.equals(uuid, announcementsEntry.getUuid()) ||
1180 (companyId != announcementsEntry.getCompanyId())) {
1181 list = null;
1182
1183 break;
1184 }
1185 }
1186 }
1187 }
1188
1189 if (list == null) {
1190 StringBundler query = null;
1191
1192 if (orderByComparator != null) {
1193 query = new StringBundler(4 +
1194 (orderByComparator.getOrderByFields().length * 3));
1195 }
1196 else {
1197 query = new StringBundler(4);
1198 }
1199
1200 query.append(_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
1201
1202 boolean bindUuid = false;
1203
1204 if (uuid == null) {
1205 query.append(_FINDER_COLUMN_UUID_C_UUID_1);
1206 }
1207 else if (uuid.equals(StringPool.BLANK)) {
1208 query.append(_FINDER_COLUMN_UUID_C_UUID_3);
1209 }
1210 else {
1211 bindUuid = true;
1212
1213 query.append(_FINDER_COLUMN_UUID_C_UUID_2);
1214 }
1215
1216 query.append(_FINDER_COLUMN_UUID_C_COMPANYID_2);
1217
1218 if (orderByComparator != null) {
1219 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1220 orderByComparator);
1221 }
1222 else
1223 if (pagination) {
1224 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
1225 }
1226
1227 String sql = query.toString();
1228
1229 Session session = null;
1230
1231 try {
1232 session = openSession();
1233
1234 Query q = session.createQuery(sql);
1235
1236 QueryPos qPos = QueryPos.getInstance(q);
1237
1238 if (bindUuid) {
1239 qPos.add(uuid);
1240 }
1241
1242 qPos.add(companyId);
1243
1244 if (!pagination) {
1245 list = (List<AnnouncementsEntry>)QueryUtil.list(q,
1246 getDialect(), start, end, false);
1247
1248 Collections.sort(list);
1249
1250 list = Collections.unmodifiableList(list);
1251 }
1252 else {
1253 list = (List<AnnouncementsEntry>)QueryUtil.list(q,
1254 getDialect(), start, end);
1255 }
1256
1257 cacheResult(list);
1258
1259 finderCache.putResult(finderPath, finderArgs, list);
1260 }
1261 catch (Exception e) {
1262 finderCache.removeResult(finderPath, finderArgs);
1263
1264 throw processException(e);
1265 }
1266 finally {
1267 closeSession(session);
1268 }
1269 }
1270
1271 return list;
1272 }
1273
1274
1283 @Override
1284 public AnnouncementsEntry findByUuid_C_First(String uuid, long companyId,
1285 OrderByComparator<AnnouncementsEntry> orderByComparator)
1286 throws NoSuchEntryException {
1287 AnnouncementsEntry announcementsEntry = fetchByUuid_C_First(uuid,
1288 companyId, orderByComparator);
1289
1290 if (announcementsEntry != null) {
1291 return announcementsEntry;
1292 }
1293
1294 StringBundler msg = new StringBundler(6);
1295
1296 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1297
1298 msg.append("uuid=");
1299 msg.append(uuid);
1300
1301 msg.append(", companyId=");
1302 msg.append(companyId);
1303
1304 msg.append(StringPool.CLOSE_CURLY_BRACE);
1305
1306 throw new NoSuchEntryException(msg.toString());
1307 }
1308
1309
1317 @Override
1318 public AnnouncementsEntry fetchByUuid_C_First(String uuid, long companyId,
1319 OrderByComparator<AnnouncementsEntry> orderByComparator) {
1320 List<AnnouncementsEntry> list = findByUuid_C(uuid, companyId, 0, 1,
1321 orderByComparator);
1322
1323 if (!list.isEmpty()) {
1324 return list.get(0);
1325 }
1326
1327 return null;
1328 }
1329
1330
1339 @Override
1340 public AnnouncementsEntry findByUuid_C_Last(String uuid, long companyId,
1341 OrderByComparator<AnnouncementsEntry> orderByComparator)
1342 throws NoSuchEntryException {
1343 AnnouncementsEntry announcementsEntry = fetchByUuid_C_Last(uuid,
1344 companyId, orderByComparator);
1345
1346 if (announcementsEntry != null) {
1347 return announcementsEntry;
1348 }
1349
1350 StringBundler msg = new StringBundler(6);
1351
1352 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1353
1354 msg.append("uuid=");
1355 msg.append(uuid);
1356
1357 msg.append(", companyId=");
1358 msg.append(companyId);
1359
1360 msg.append(StringPool.CLOSE_CURLY_BRACE);
1361
1362 throw new NoSuchEntryException(msg.toString());
1363 }
1364
1365
1373 @Override
1374 public AnnouncementsEntry fetchByUuid_C_Last(String uuid, long companyId,
1375 OrderByComparator<AnnouncementsEntry> orderByComparator) {
1376 int count = countByUuid_C(uuid, companyId);
1377
1378 if (count == 0) {
1379 return null;
1380 }
1381
1382 List<AnnouncementsEntry> list = findByUuid_C(uuid, companyId,
1383 count - 1, count, orderByComparator);
1384
1385 if (!list.isEmpty()) {
1386 return list.get(0);
1387 }
1388
1389 return null;
1390 }
1391
1392
1402 @Override
1403 public AnnouncementsEntry[] findByUuid_C_PrevAndNext(long entryId,
1404 String uuid, long companyId,
1405 OrderByComparator<AnnouncementsEntry> orderByComparator)
1406 throws NoSuchEntryException {
1407 AnnouncementsEntry announcementsEntry = findByPrimaryKey(entryId);
1408
1409 Session session = null;
1410
1411 try {
1412 session = openSession();
1413
1414 AnnouncementsEntry[] array = new AnnouncementsEntryImpl[3];
1415
1416 array[0] = getByUuid_C_PrevAndNext(session, announcementsEntry,
1417 uuid, companyId, orderByComparator, true);
1418
1419 array[1] = announcementsEntry;
1420
1421 array[2] = getByUuid_C_PrevAndNext(session, announcementsEntry,
1422 uuid, companyId, orderByComparator, false);
1423
1424 return array;
1425 }
1426 catch (Exception e) {
1427 throw processException(e);
1428 }
1429 finally {
1430 closeSession(session);
1431 }
1432 }
1433
1434 protected AnnouncementsEntry getByUuid_C_PrevAndNext(Session session,
1435 AnnouncementsEntry announcementsEntry, String uuid, long companyId,
1436 OrderByComparator<AnnouncementsEntry> orderByComparator,
1437 boolean previous) {
1438 StringBundler query = null;
1439
1440 if (orderByComparator != null) {
1441 query = new StringBundler(6 +
1442 (orderByComparator.getOrderByFields().length * 6));
1443 }
1444 else {
1445 query = new StringBundler(3);
1446 }
1447
1448 query.append(_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
1449
1450 boolean bindUuid = false;
1451
1452 if (uuid == null) {
1453 query.append(_FINDER_COLUMN_UUID_C_UUID_1);
1454 }
1455 else if (uuid.equals(StringPool.BLANK)) {
1456 query.append(_FINDER_COLUMN_UUID_C_UUID_3);
1457 }
1458 else {
1459 bindUuid = true;
1460
1461 query.append(_FINDER_COLUMN_UUID_C_UUID_2);
1462 }
1463
1464 query.append(_FINDER_COLUMN_UUID_C_COMPANYID_2);
1465
1466 if (orderByComparator != null) {
1467 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1468
1469 if (orderByConditionFields.length > 0) {
1470 query.append(WHERE_AND);
1471 }
1472
1473 for (int i = 0; i < orderByConditionFields.length; i++) {
1474 query.append(_ORDER_BY_ENTITY_ALIAS);
1475 query.append(orderByConditionFields[i]);
1476
1477 if ((i + 1) < orderByConditionFields.length) {
1478 if (orderByComparator.isAscending() ^ previous) {
1479 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1480 }
1481 else {
1482 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1483 }
1484 }
1485 else {
1486 if (orderByComparator.isAscending() ^ previous) {
1487 query.append(WHERE_GREATER_THAN);
1488 }
1489 else {
1490 query.append(WHERE_LESSER_THAN);
1491 }
1492 }
1493 }
1494
1495 query.append(ORDER_BY_CLAUSE);
1496
1497 String[] orderByFields = orderByComparator.getOrderByFields();
1498
1499 for (int i = 0; i < orderByFields.length; i++) {
1500 query.append(_ORDER_BY_ENTITY_ALIAS);
1501 query.append(orderByFields[i]);
1502
1503 if ((i + 1) < orderByFields.length) {
1504 if (orderByComparator.isAscending() ^ previous) {
1505 query.append(ORDER_BY_ASC_HAS_NEXT);
1506 }
1507 else {
1508 query.append(ORDER_BY_DESC_HAS_NEXT);
1509 }
1510 }
1511 else {
1512 if (orderByComparator.isAscending() ^ previous) {
1513 query.append(ORDER_BY_ASC);
1514 }
1515 else {
1516 query.append(ORDER_BY_DESC);
1517 }
1518 }
1519 }
1520 }
1521 else {
1522 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
1523 }
1524
1525 String sql = query.toString();
1526
1527 Query q = session.createQuery(sql);
1528
1529 q.setFirstResult(0);
1530 q.setMaxResults(2);
1531
1532 QueryPos qPos = QueryPos.getInstance(q);
1533
1534 if (bindUuid) {
1535 qPos.add(uuid);
1536 }
1537
1538 qPos.add(companyId);
1539
1540 if (orderByComparator != null) {
1541 Object[] values = orderByComparator.getOrderByConditionValues(announcementsEntry);
1542
1543 for (Object value : values) {
1544 qPos.add(value);
1545 }
1546 }
1547
1548 List<AnnouncementsEntry> list = q.list();
1549
1550 if (list.size() == 2) {
1551 return list.get(1);
1552 }
1553 else {
1554 return null;
1555 }
1556 }
1557
1558
1565 @Override
1566 public List<AnnouncementsEntry> filterFindByUuid_C(String uuid,
1567 long companyId) {
1568 return filterFindByUuid_C(uuid, companyId, QueryUtil.ALL_POS,
1569 QueryUtil.ALL_POS, null);
1570 }
1571
1572
1585 @Override
1586 public List<AnnouncementsEntry> filterFindByUuid_C(String uuid,
1587 long companyId, int start, int end) {
1588 return filterFindByUuid_C(uuid, companyId, start, end, null);
1589 }
1590
1591
1605 @Override
1606 public List<AnnouncementsEntry> filterFindByUuid_C(String uuid,
1607 long companyId, int start, int end,
1608 OrderByComparator<AnnouncementsEntry> orderByComparator) {
1609 if (!InlineSQLHelperUtil.isEnabled()) {
1610 return findByUuid_C(uuid, companyId, start, end, orderByComparator);
1611 }
1612
1613 StringBundler query = null;
1614
1615 if (orderByComparator != null) {
1616 query = new StringBundler(4 +
1617 (orderByComparator.getOrderByFields().length * 3));
1618 }
1619 else {
1620 query = new StringBundler(4);
1621 }
1622
1623 if (getDB().isSupportsInlineDistinct()) {
1624 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
1625 }
1626 else {
1627 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_1);
1628 }
1629
1630 boolean bindUuid = false;
1631
1632 if (uuid == null) {
1633 query.append(_FINDER_COLUMN_UUID_C_UUID_1_SQL);
1634 }
1635 else if (uuid.equals(StringPool.BLANK)) {
1636 query.append(_FINDER_COLUMN_UUID_C_UUID_3_SQL);
1637 }
1638 else {
1639 bindUuid = true;
1640
1641 query.append(_FINDER_COLUMN_UUID_C_UUID_2_SQL);
1642 }
1643
1644 query.append(_FINDER_COLUMN_UUID_C_COMPANYID_2);
1645
1646 if (!getDB().isSupportsInlineDistinct()) {
1647 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_2);
1648 }
1649
1650 if (orderByComparator != null) {
1651 if (getDB().isSupportsInlineDistinct()) {
1652 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1653 orderByComparator, true);
1654 }
1655 else {
1656 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
1657 orderByComparator, true);
1658 }
1659 }
1660 else {
1661 if (getDB().isSupportsInlineDistinct()) {
1662 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
1663 }
1664 else {
1665 query.append(AnnouncementsEntryModelImpl.ORDER_BY_SQL);
1666 }
1667 }
1668
1669 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1670 AnnouncementsEntry.class.getName(),
1671 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
1672
1673 Session session = null;
1674
1675 try {
1676 session = openSession();
1677
1678 SQLQuery q = session.createSynchronizedSQLQuery(sql);
1679
1680 if (getDB().isSupportsInlineDistinct()) {
1681 q.addEntity(_FILTER_ENTITY_ALIAS, AnnouncementsEntryImpl.class);
1682 }
1683 else {
1684 q.addEntity(_FILTER_ENTITY_TABLE, AnnouncementsEntryImpl.class);
1685 }
1686
1687 QueryPos qPos = QueryPos.getInstance(q);
1688
1689 if (bindUuid) {
1690 qPos.add(uuid);
1691 }
1692
1693 qPos.add(companyId);
1694
1695 return (List<AnnouncementsEntry>)QueryUtil.list(q, getDialect(),
1696 start, end);
1697 }
1698 catch (Exception e) {
1699 throw processException(e);
1700 }
1701 finally {
1702 closeSession(session);
1703 }
1704 }
1705
1706
1716 @Override
1717 public AnnouncementsEntry[] filterFindByUuid_C_PrevAndNext(long entryId,
1718 String uuid, long companyId,
1719 OrderByComparator<AnnouncementsEntry> orderByComparator)
1720 throws NoSuchEntryException {
1721 if (!InlineSQLHelperUtil.isEnabled()) {
1722 return findByUuid_C_PrevAndNext(entryId, uuid, companyId,
1723 orderByComparator);
1724 }
1725
1726 AnnouncementsEntry announcementsEntry = findByPrimaryKey(entryId);
1727
1728 Session session = null;
1729
1730 try {
1731 session = openSession();
1732
1733 AnnouncementsEntry[] array = new AnnouncementsEntryImpl[3];
1734
1735 array[0] = filterGetByUuid_C_PrevAndNext(session,
1736 announcementsEntry, uuid, companyId, orderByComparator, true);
1737
1738 array[1] = announcementsEntry;
1739
1740 array[2] = filterGetByUuid_C_PrevAndNext(session,
1741 announcementsEntry, uuid, companyId, orderByComparator,
1742 false);
1743
1744 return array;
1745 }
1746 catch (Exception e) {
1747 throw processException(e);
1748 }
1749 finally {
1750 closeSession(session);
1751 }
1752 }
1753
1754 protected AnnouncementsEntry filterGetByUuid_C_PrevAndNext(
1755 Session session, AnnouncementsEntry announcementsEntry, String uuid,
1756 long companyId,
1757 OrderByComparator<AnnouncementsEntry> orderByComparator,
1758 boolean previous) {
1759 StringBundler query = null;
1760
1761 if (orderByComparator != null) {
1762 query = new StringBundler(6 +
1763 (orderByComparator.getOrderByFields().length * 6));
1764 }
1765 else {
1766 query = new StringBundler(3);
1767 }
1768
1769 if (getDB().isSupportsInlineDistinct()) {
1770 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
1771 }
1772 else {
1773 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_1);
1774 }
1775
1776 boolean bindUuid = false;
1777
1778 if (uuid == null) {
1779 query.append(_FINDER_COLUMN_UUID_C_UUID_1_SQL);
1780 }
1781 else if (uuid.equals(StringPool.BLANK)) {
1782 query.append(_FINDER_COLUMN_UUID_C_UUID_3_SQL);
1783 }
1784 else {
1785 bindUuid = true;
1786
1787 query.append(_FINDER_COLUMN_UUID_C_UUID_2_SQL);
1788 }
1789
1790 query.append(_FINDER_COLUMN_UUID_C_COMPANYID_2);
1791
1792 if (!getDB().isSupportsInlineDistinct()) {
1793 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_2);
1794 }
1795
1796 if (orderByComparator != null) {
1797 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1798
1799 if (orderByConditionFields.length > 0) {
1800 query.append(WHERE_AND);
1801 }
1802
1803 for (int i = 0; i < orderByConditionFields.length; i++) {
1804 if (getDB().isSupportsInlineDistinct()) {
1805 query.append(_ORDER_BY_ENTITY_ALIAS);
1806 }
1807 else {
1808 query.append(_ORDER_BY_ENTITY_TABLE);
1809 }
1810
1811 query.append(orderByConditionFields[i]);
1812
1813 if ((i + 1) < orderByConditionFields.length) {
1814 if (orderByComparator.isAscending() ^ previous) {
1815 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1816 }
1817 else {
1818 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1819 }
1820 }
1821 else {
1822 if (orderByComparator.isAscending() ^ previous) {
1823 query.append(WHERE_GREATER_THAN);
1824 }
1825 else {
1826 query.append(WHERE_LESSER_THAN);
1827 }
1828 }
1829 }
1830
1831 query.append(ORDER_BY_CLAUSE);
1832
1833 String[] orderByFields = orderByComparator.getOrderByFields();
1834
1835 for (int i = 0; i < orderByFields.length; i++) {
1836 if (getDB().isSupportsInlineDistinct()) {
1837 query.append(_ORDER_BY_ENTITY_ALIAS);
1838 }
1839 else {
1840 query.append(_ORDER_BY_ENTITY_TABLE);
1841 }
1842
1843 query.append(orderByFields[i]);
1844
1845 if ((i + 1) < orderByFields.length) {
1846 if (orderByComparator.isAscending() ^ previous) {
1847 query.append(ORDER_BY_ASC_HAS_NEXT);
1848 }
1849 else {
1850 query.append(ORDER_BY_DESC_HAS_NEXT);
1851 }
1852 }
1853 else {
1854 if (orderByComparator.isAscending() ^ previous) {
1855 query.append(ORDER_BY_ASC);
1856 }
1857 else {
1858 query.append(ORDER_BY_DESC);
1859 }
1860 }
1861 }
1862 }
1863 else {
1864 if (getDB().isSupportsInlineDistinct()) {
1865 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
1866 }
1867 else {
1868 query.append(AnnouncementsEntryModelImpl.ORDER_BY_SQL);
1869 }
1870 }
1871
1872 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1873 AnnouncementsEntry.class.getName(),
1874 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
1875
1876 SQLQuery q = session.createSynchronizedSQLQuery(sql);
1877
1878 q.setFirstResult(0);
1879 q.setMaxResults(2);
1880
1881 if (getDB().isSupportsInlineDistinct()) {
1882 q.addEntity(_FILTER_ENTITY_ALIAS, AnnouncementsEntryImpl.class);
1883 }
1884 else {
1885 q.addEntity(_FILTER_ENTITY_TABLE, AnnouncementsEntryImpl.class);
1886 }
1887
1888 QueryPos qPos = QueryPos.getInstance(q);
1889
1890 if (bindUuid) {
1891 qPos.add(uuid);
1892 }
1893
1894 qPos.add(companyId);
1895
1896 if (orderByComparator != null) {
1897 Object[] values = orderByComparator.getOrderByConditionValues(announcementsEntry);
1898
1899 for (Object value : values) {
1900 qPos.add(value);
1901 }
1902 }
1903
1904 List<AnnouncementsEntry> list = q.list();
1905
1906 if (list.size() == 2) {
1907 return list.get(1);
1908 }
1909 else {
1910 return null;
1911 }
1912 }
1913
1914
1920 @Override
1921 public void removeByUuid_C(String uuid, long companyId) {
1922 for (AnnouncementsEntry announcementsEntry : findByUuid_C(uuid,
1923 companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
1924 remove(announcementsEntry);
1925 }
1926 }
1927
1928
1935 @Override
1936 public int countByUuid_C(String uuid, long companyId) {
1937 FinderPath finderPath = FINDER_PATH_COUNT_BY_UUID_C;
1938
1939 Object[] finderArgs = new Object[] { uuid, companyId };
1940
1941 Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);
1942
1943 if (count == null) {
1944 StringBundler query = new StringBundler(3);
1945
1946 query.append(_SQL_COUNT_ANNOUNCEMENTSENTRY_WHERE);
1947
1948 boolean bindUuid = false;
1949
1950 if (uuid == null) {
1951 query.append(_FINDER_COLUMN_UUID_C_UUID_1);
1952 }
1953 else if (uuid.equals(StringPool.BLANK)) {
1954 query.append(_FINDER_COLUMN_UUID_C_UUID_3);
1955 }
1956 else {
1957 bindUuid = true;
1958
1959 query.append(_FINDER_COLUMN_UUID_C_UUID_2);
1960 }
1961
1962 query.append(_FINDER_COLUMN_UUID_C_COMPANYID_2);
1963
1964 String sql = query.toString();
1965
1966 Session session = null;
1967
1968 try {
1969 session = openSession();
1970
1971 Query q = session.createQuery(sql);
1972
1973 QueryPos qPos = QueryPos.getInstance(q);
1974
1975 if (bindUuid) {
1976 qPos.add(uuid);
1977 }
1978
1979 qPos.add(companyId);
1980
1981 count = (Long)q.uniqueResult();
1982
1983 finderCache.putResult(finderPath, finderArgs, count);
1984 }
1985 catch (Exception e) {
1986 finderCache.removeResult(finderPath, finderArgs);
1987
1988 throw processException(e);
1989 }
1990 finally {
1991 closeSession(session);
1992 }
1993 }
1994
1995 return count.intValue();
1996 }
1997
1998
2005 @Override
2006 public int filterCountByUuid_C(String uuid, long companyId) {
2007 if (!InlineSQLHelperUtil.isEnabled()) {
2008 return countByUuid_C(uuid, companyId);
2009 }
2010
2011 StringBundler query = new StringBundler(3);
2012
2013 query.append(_FILTER_SQL_COUNT_ANNOUNCEMENTSENTRY_WHERE);
2014
2015 boolean bindUuid = false;
2016
2017 if (uuid == null) {
2018 query.append(_FINDER_COLUMN_UUID_C_UUID_1_SQL);
2019 }
2020 else if (uuid.equals(StringPool.BLANK)) {
2021 query.append(_FINDER_COLUMN_UUID_C_UUID_3_SQL);
2022 }
2023 else {
2024 bindUuid = true;
2025
2026 query.append(_FINDER_COLUMN_UUID_C_UUID_2_SQL);
2027 }
2028
2029 query.append(_FINDER_COLUMN_UUID_C_COMPANYID_2);
2030
2031 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2032 AnnouncementsEntry.class.getName(),
2033 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
2034
2035 Session session = null;
2036
2037 try {
2038 session = openSession();
2039
2040 SQLQuery q = session.createSynchronizedSQLQuery(sql);
2041
2042 q.addScalar(COUNT_COLUMN_NAME,
2043 com.liferay.portal.kernel.dao.orm.Type.LONG);
2044
2045 QueryPos qPos = QueryPos.getInstance(q);
2046
2047 if (bindUuid) {
2048 qPos.add(uuid);
2049 }
2050
2051 qPos.add(companyId);
2052
2053 Long count = (Long)q.uniqueResult();
2054
2055 return count.intValue();
2056 }
2057 catch (Exception e) {
2058 throw processException(e);
2059 }
2060 finally {
2061 closeSession(session);
2062 }
2063 }
2064
2065 private static final String _FINDER_COLUMN_UUID_C_UUID_1 = "announcementsEntry.uuid IS NULL AND ";
2066 private static final String _FINDER_COLUMN_UUID_C_UUID_2 = "announcementsEntry.uuid = ? AND ";
2067 private static final String _FINDER_COLUMN_UUID_C_UUID_3 = "(announcementsEntry.uuid IS NULL OR announcementsEntry.uuid = '') AND ";
2068 private static final String _FINDER_COLUMN_UUID_C_UUID_1_SQL = "announcementsEntry.uuid_ IS NULL AND ";
2069 private static final String _FINDER_COLUMN_UUID_C_UUID_2_SQL = "announcementsEntry.uuid_ = ? AND ";
2070 private static final String _FINDER_COLUMN_UUID_C_UUID_3_SQL = "(announcementsEntry.uuid_ IS NULL OR announcementsEntry.uuid_ = '') AND ";
2071 private static final String _FINDER_COLUMN_UUID_C_COMPANYID_2 = "announcementsEntry.companyId = ?";
2072 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_USERID = new FinderPath(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
2073 AnnouncementsEntryModelImpl.FINDER_CACHE_ENABLED,
2074 AnnouncementsEntryImpl.class,
2075 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByUserId",
2076 new String[] {
2077 Long.class.getName(),
2078
2079 Integer.class.getName(), Integer.class.getName(),
2080 OrderByComparator.class.getName()
2081 });
2082 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID =
2083 new FinderPath(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
2084 AnnouncementsEntryModelImpl.FINDER_CACHE_ENABLED,
2085 AnnouncementsEntryImpl.class,
2086 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByUserId",
2087 new String[] { Long.class.getName() },
2088 AnnouncementsEntryModelImpl.USERID_COLUMN_BITMASK |
2089 AnnouncementsEntryModelImpl.PRIORITY_COLUMN_BITMASK |
2090 AnnouncementsEntryModelImpl.MODIFIEDDATE_COLUMN_BITMASK);
2091 public static final FinderPath FINDER_PATH_COUNT_BY_USERID = new FinderPath(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
2092 AnnouncementsEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
2093 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUserId",
2094 new String[] { Long.class.getName() });
2095
2096
2102 @Override
2103 public List<AnnouncementsEntry> findByUserId(long userId) {
2104 return findByUserId(userId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2105 }
2106
2107
2119 @Override
2120 public List<AnnouncementsEntry> findByUserId(long userId, int start, int end) {
2121 return findByUserId(userId, start, end, null);
2122 }
2123
2124
2137 @Override
2138 public List<AnnouncementsEntry> findByUserId(long userId, int start,
2139 int end, OrderByComparator<AnnouncementsEntry> orderByComparator) {
2140 return findByUserId(userId, start, end, orderByComparator, true);
2141 }
2142
2143
2157 @Override
2158 public List<AnnouncementsEntry> findByUserId(long userId, int start,
2159 int end, OrderByComparator<AnnouncementsEntry> orderByComparator,
2160 boolean retrieveFromCache) {
2161 boolean pagination = true;
2162 FinderPath finderPath = null;
2163 Object[] finderArgs = null;
2164
2165 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2166 (orderByComparator == null)) {
2167 pagination = false;
2168 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID;
2169 finderArgs = new Object[] { userId };
2170 }
2171 else {
2172 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_USERID;
2173 finderArgs = new Object[] { userId, start, end, orderByComparator };
2174 }
2175
2176 List<AnnouncementsEntry> list = null;
2177
2178 if (retrieveFromCache) {
2179 list = (List<AnnouncementsEntry>)finderCache.getResult(finderPath,
2180 finderArgs, this);
2181
2182 if ((list != null) && !list.isEmpty()) {
2183 for (AnnouncementsEntry announcementsEntry : list) {
2184 if ((userId != announcementsEntry.getUserId())) {
2185 list = null;
2186
2187 break;
2188 }
2189 }
2190 }
2191 }
2192
2193 if (list == null) {
2194 StringBundler query = null;
2195
2196 if (orderByComparator != null) {
2197 query = new StringBundler(3 +
2198 (orderByComparator.getOrderByFields().length * 3));
2199 }
2200 else {
2201 query = new StringBundler(3);
2202 }
2203
2204 query.append(_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
2205
2206 query.append(_FINDER_COLUMN_USERID_USERID_2);
2207
2208 if (orderByComparator != null) {
2209 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2210 orderByComparator);
2211 }
2212 else
2213 if (pagination) {
2214 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
2215 }
2216
2217 String sql = query.toString();
2218
2219 Session session = null;
2220
2221 try {
2222 session = openSession();
2223
2224 Query q = session.createQuery(sql);
2225
2226 QueryPos qPos = QueryPos.getInstance(q);
2227
2228 qPos.add(userId);
2229
2230 if (!pagination) {
2231 list = (List<AnnouncementsEntry>)QueryUtil.list(q,
2232 getDialect(), start, end, false);
2233
2234 Collections.sort(list);
2235
2236 list = Collections.unmodifiableList(list);
2237 }
2238 else {
2239 list = (List<AnnouncementsEntry>)QueryUtil.list(q,
2240 getDialect(), start, end);
2241 }
2242
2243 cacheResult(list);
2244
2245 finderCache.putResult(finderPath, finderArgs, list);
2246 }
2247 catch (Exception e) {
2248 finderCache.removeResult(finderPath, finderArgs);
2249
2250 throw processException(e);
2251 }
2252 finally {
2253 closeSession(session);
2254 }
2255 }
2256
2257 return list;
2258 }
2259
2260
2268 @Override
2269 public AnnouncementsEntry findByUserId_First(long userId,
2270 OrderByComparator<AnnouncementsEntry> orderByComparator)
2271 throws NoSuchEntryException {
2272 AnnouncementsEntry announcementsEntry = fetchByUserId_First(userId,
2273 orderByComparator);
2274
2275 if (announcementsEntry != null) {
2276 return announcementsEntry;
2277 }
2278
2279 StringBundler msg = new StringBundler(4);
2280
2281 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2282
2283 msg.append("userId=");
2284 msg.append(userId);
2285
2286 msg.append(StringPool.CLOSE_CURLY_BRACE);
2287
2288 throw new NoSuchEntryException(msg.toString());
2289 }
2290
2291
2298 @Override
2299 public AnnouncementsEntry fetchByUserId_First(long userId,
2300 OrderByComparator<AnnouncementsEntry> orderByComparator) {
2301 List<AnnouncementsEntry> list = findByUserId(userId, 0, 1,
2302 orderByComparator);
2303
2304 if (!list.isEmpty()) {
2305 return list.get(0);
2306 }
2307
2308 return null;
2309 }
2310
2311
2319 @Override
2320 public AnnouncementsEntry findByUserId_Last(long userId,
2321 OrderByComparator<AnnouncementsEntry> orderByComparator)
2322 throws NoSuchEntryException {
2323 AnnouncementsEntry announcementsEntry = fetchByUserId_Last(userId,
2324 orderByComparator);
2325
2326 if (announcementsEntry != null) {
2327 return announcementsEntry;
2328 }
2329
2330 StringBundler msg = new StringBundler(4);
2331
2332 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2333
2334 msg.append("userId=");
2335 msg.append(userId);
2336
2337 msg.append(StringPool.CLOSE_CURLY_BRACE);
2338
2339 throw new NoSuchEntryException(msg.toString());
2340 }
2341
2342
2349 @Override
2350 public AnnouncementsEntry fetchByUserId_Last(long userId,
2351 OrderByComparator<AnnouncementsEntry> orderByComparator) {
2352 int count = countByUserId(userId);
2353
2354 if (count == 0) {
2355 return null;
2356 }
2357
2358 List<AnnouncementsEntry> list = findByUserId(userId, count - 1, count,
2359 orderByComparator);
2360
2361 if (!list.isEmpty()) {
2362 return list.get(0);
2363 }
2364
2365 return null;
2366 }
2367
2368
2377 @Override
2378 public AnnouncementsEntry[] findByUserId_PrevAndNext(long entryId,
2379 long userId, OrderByComparator<AnnouncementsEntry> orderByComparator)
2380 throws NoSuchEntryException {
2381 AnnouncementsEntry announcementsEntry = findByPrimaryKey(entryId);
2382
2383 Session session = null;
2384
2385 try {
2386 session = openSession();
2387
2388 AnnouncementsEntry[] array = new AnnouncementsEntryImpl[3];
2389
2390 array[0] = getByUserId_PrevAndNext(session, announcementsEntry,
2391 userId, orderByComparator, true);
2392
2393 array[1] = announcementsEntry;
2394
2395 array[2] = getByUserId_PrevAndNext(session, announcementsEntry,
2396 userId, orderByComparator, false);
2397
2398 return array;
2399 }
2400 catch (Exception e) {
2401 throw processException(e);
2402 }
2403 finally {
2404 closeSession(session);
2405 }
2406 }
2407
2408 protected AnnouncementsEntry getByUserId_PrevAndNext(Session session,
2409 AnnouncementsEntry announcementsEntry, long userId,
2410 OrderByComparator<AnnouncementsEntry> orderByComparator,
2411 boolean previous) {
2412 StringBundler query = null;
2413
2414 if (orderByComparator != null) {
2415 query = new StringBundler(6 +
2416 (orderByComparator.getOrderByFields().length * 6));
2417 }
2418 else {
2419 query = new StringBundler(3);
2420 }
2421
2422 query.append(_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
2423
2424 query.append(_FINDER_COLUMN_USERID_USERID_2);
2425
2426 if (orderByComparator != null) {
2427 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2428
2429 if (orderByConditionFields.length > 0) {
2430 query.append(WHERE_AND);
2431 }
2432
2433 for (int i = 0; i < orderByConditionFields.length; i++) {
2434 query.append(_ORDER_BY_ENTITY_ALIAS);
2435 query.append(orderByConditionFields[i]);
2436
2437 if ((i + 1) < orderByConditionFields.length) {
2438 if (orderByComparator.isAscending() ^ previous) {
2439 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2440 }
2441 else {
2442 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2443 }
2444 }
2445 else {
2446 if (orderByComparator.isAscending() ^ previous) {
2447 query.append(WHERE_GREATER_THAN);
2448 }
2449 else {
2450 query.append(WHERE_LESSER_THAN);
2451 }
2452 }
2453 }
2454
2455 query.append(ORDER_BY_CLAUSE);
2456
2457 String[] orderByFields = orderByComparator.getOrderByFields();
2458
2459 for (int i = 0; i < orderByFields.length; i++) {
2460 query.append(_ORDER_BY_ENTITY_ALIAS);
2461 query.append(orderByFields[i]);
2462
2463 if ((i + 1) < orderByFields.length) {
2464 if (orderByComparator.isAscending() ^ previous) {
2465 query.append(ORDER_BY_ASC_HAS_NEXT);
2466 }
2467 else {
2468 query.append(ORDER_BY_DESC_HAS_NEXT);
2469 }
2470 }
2471 else {
2472 if (orderByComparator.isAscending() ^ previous) {
2473 query.append(ORDER_BY_ASC);
2474 }
2475 else {
2476 query.append(ORDER_BY_DESC);
2477 }
2478 }
2479 }
2480 }
2481 else {
2482 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
2483 }
2484
2485 String sql = query.toString();
2486
2487 Query q = session.createQuery(sql);
2488
2489 q.setFirstResult(0);
2490 q.setMaxResults(2);
2491
2492 QueryPos qPos = QueryPos.getInstance(q);
2493
2494 qPos.add(userId);
2495
2496 if (orderByComparator != null) {
2497 Object[] values = orderByComparator.getOrderByConditionValues(announcementsEntry);
2498
2499 for (Object value : values) {
2500 qPos.add(value);
2501 }
2502 }
2503
2504 List<AnnouncementsEntry> list = q.list();
2505
2506 if (list.size() == 2) {
2507 return list.get(1);
2508 }
2509 else {
2510 return null;
2511 }
2512 }
2513
2514
2520 @Override
2521 public List<AnnouncementsEntry> filterFindByUserId(long userId) {
2522 return filterFindByUserId(userId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
2523 null);
2524 }
2525
2526
2538 @Override
2539 public List<AnnouncementsEntry> filterFindByUserId(long userId, int start,
2540 int end) {
2541 return filterFindByUserId(userId, start, end, null);
2542 }
2543
2544
2557 @Override
2558 public List<AnnouncementsEntry> filterFindByUserId(long userId, int start,
2559 int end, OrderByComparator<AnnouncementsEntry> orderByComparator) {
2560 if (!InlineSQLHelperUtil.isEnabled()) {
2561 return findByUserId(userId, start, end, orderByComparator);
2562 }
2563
2564 StringBundler query = null;
2565
2566 if (orderByComparator != null) {
2567 query = new StringBundler(3 +
2568 (orderByComparator.getOrderByFields().length * 3));
2569 }
2570 else {
2571 query = new StringBundler(3);
2572 }
2573
2574 if (getDB().isSupportsInlineDistinct()) {
2575 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
2576 }
2577 else {
2578 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_1);
2579 }
2580
2581 query.append(_FINDER_COLUMN_USERID_USERID_2);
2582
2583 if (!getDB().isSupportsInlineDistinct()) {
2584 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_2);
2585 }
2586
2587 if (orderByComparator != null) {
2588 if (getDB().isSupportsInlineDistinct()) {
2589 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2590 orderByComparator, true);
2591 }
2592 else {
2593 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
2594 orderByComparator, true);
2595 }
2596 }
2597 else {
2598 if (getDB().isSupportsInlineDistinct()) {
2599 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
2600 }
2601 else {
2602 query.append(AnnouncementsEntryModelImpl.ORDER_BY_SQL);
2603 }
2604 }
2605
2606 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2607 AnnouncementsEntry.class.getName(),
2608 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
2609
2610 Session session = null;
2611
2612 try {
2613 session = openSession();
2614
2615 SQLQuery q = session.createSynchronizedSQLQuery(sql);
2616
2617 if (getDB().isSupportsInlineDistinct()) {
2618 q.addEntity(_FILTER_ENTITY_ALIAS, AnnouncementsEntryImpl.class);
2619 }
2620 else {
2621 q.addEntity(_FILTER_ENTITY_TABLE, AnnouncementsEntryImpl.class);
2622 }
2623
2624 QueryPos qPos = QueryPos.getInstance(q);
2625
2626 qPos.add(userId);
2627
2628 return (List<AnnouncementsEntry>)QueryUtil.list(q, getDialect(),
2629 start, end);
2630 }
2631 catch (Exception e) {
2632 throw processException(e);
2633 }
2634 finally {
2635 closeSession(session);
2636 }
2637 }
2638
2639
2648 @Override
2649 public AnnouncementsEntry[] filterFindByUserId_PrevAndNext(long entryId,
2650 long userId, OrderByComparator<AnnouncementsEntry> orderByComparator)
2651 throws NoSuchEntryException {
2652 if (!InlineSQLHelperUtil.isEnabled()) {
2653 return findByUserId_PrevAndNext(entryId, userId, orderByComparator);
2654 }
2655
2656 AnnouncementsEntry announcementsEntry = findByPrimaryKey(entryId);
2657
2658 Session session = null;
2659
2660 try {
2661 session = openSession();
2662
2663 AnnouncementsEntry[] array = new AnnouncementsEntryImpl[3];
2664
2665 array[0] = filterGetByUserId_PrevAndNext(session,
2666 announcementsEntry, userId, orderByComparator, true);
2667
2668 array[1] = announcementsEntry;
2669
2670 array[2] = filterGetByUserId_PrevAndNext(session,
2671 announcementsEntry, userId, orderByComparator, false);
2672
2673 return array;
2674 }
2675 catch (Exception e) {
2676 throw processException(e);
2677 }
2678 finally {
2679 closeSession(session);
2680 }
2681 }
2682
2683 protected AnnouncementsEntry filterGetByUserId_PrevAndNext(
2684 Session session, AnnouncementsEntry announcementsEntry, long userId,
2685 OrderByComparator<AnnouncementsEntry> orderByComparator,
2686 boolean previous) {
2687 StringBundler query = null;
2688
2689 if (orderByComparator != null) {
2690 query = new StringBundler(6 +
2691 (orderByComparator.getOrderByFields().length * 6));
2692 }
2693 else {
2694 query = new StringBundler(3);
2695 }
2696
2697 if (getDB().isSupportsInlineDistinct()) {
2698 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
2699 }
2700 else {
2701 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_1);
2702 }
2703
2704 query.append(_FINDER_COLUMN_USERID_USERID_2);
2705
2706 if (!getDB().isSupportsInlineDistinct()) {
2707 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_2);
2708 }
2709
2710 if (orderByComparator != null) {
2711 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2712
2713 if (orderByConditionFields.length > 0) {
2714 query.append(WHERE_AND);
2715 }
2716
2717 for (int i = 0; i < orderByConditionFields.length; i++) {
2718 if (getDB().isSupportsInlineDistinct()) {
2719 query.append(_ORDER_BY_ENTITY_ALIAS);
2720 }
2721 else {
2722 query.append(_ORDER_BY_ENTITY_TABLE);
2723 }
2724
2725 query.append(orderByConditionFields[i]);
2726
2727 if ((i + 1) < orderByConditionFields.length) {
2728 if (orderByComparator.isAscending() ^ previous) {
2729 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2730 }
2731 else {
2732 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2733 }
2734 }
2735 else {
2736 if (orderByComparator.isAscending() ^ previous) {
2737 query.append(WHERE_GREATER_THAN);
2738 }
2739 else {
2740 query.append(WHERE_LESSER_THAN);
2741 }
2742 }
2743 }
2744
2745 query.append(ORDER_BY_CLAUSE);
2746
2747 String[] orderByFields = orderByComparator.getOrderByFields();
2748
2749 for (int i = 0; i < orderByFields.length; i++) {
2750 if (getDB().isSupportsInlineDistinct()) {
2751 query.append(_ORDER_BY_ENTITY_ALIAS);
2752 }
2753 else {
2754 query.append(_ORDER_BY_ENTITY_TABLE);
2755 }
2756
2757 query.append(orderByFields[i]);
2758
2759 if ((i + 1) < orderByFields.length) {
2760 if (orderByComparator.isAscending() ^ previous) {
2761 query.append(ORDER_BY_ASC_HAS_NEXT);
2762 }
2763 else {
2764 query.append(ORDER_BY_DESC_HAS_NEXT);
2765 }
2766 }
2767 else {
2768 if (orderByComparator.isAscending() ^ previous) {
2769 query.append(ORDER_BY_ASC);
2770 }
2771 else {
2772 query.append(ORDER_BY_DESC);
2773 }
2774 }
2775 }
2776 }
2777 else {
2778 if (getDB().isSupportsInlineDistinct()) {
2779 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
2780 }
2781 else {
2782 query.append(AnnouncementsEntryModelImpl.ORDER_BY_SQL);
2783 }
2784 }
2785
2786 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2787 AnnouncementsEntry.class.getName(),
2788 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
2789
2790 SQLQuery q = session.createSynchronizedSQLQuery(sql);
2791
2792 q.setFirstResult(0);
2793 q.setMaxResults(2);
2794
2795 if (getDB().isSupportsInlineDistinct()) {
2796 q.addEntity(_FILTER_ENTITY_ALIAS, AnnouncementsEntryImpl.class);
2797 }
2798 else {
2799 q.addEntity(_FILTER_ENTITY_TABLE, AnnouncementsEntryImpl.class);
2800 }
2801
2802 QueryPos qPos = QueryPos.getInstance(q);
2803
2804 qPos.add(userId);
2805
2806 if (orderByComparator != null) {
2807 Object[] values = orderByComparator.getOrderByConditionValues(announcementsEntry);
2808
2809 for (Object value : values) {
2810 qPos.add(value);
2811 }
2812 }
2813
2814 List<AnnouncementsEntry> list = q.list();
2815
2816 if (list.size() == 2) {
2817 return list.get(1);
2818 }
2819 else {
2820 return null;
2821 }
2822 }
2823
2824
2829 @Override
2830 public void removeByUserId(long userId) {
2831 for (AnnouncementsEntry announcementsEntry : findByUserId(userId,
2832 QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
2833 remove(announcementsEntry);
2834 }
2835 }
2836
2837
2843 @Override
2844 public int countByUserId(long userId) {
2845 FinderPath finderPath = FINDER_PATH_COUNT_BY_USERID;
2846
2847 Object[] finderArgs = new Object[] { userId };
2848
2849 Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);
2850
2851 if (count == null) {
2852 StringBundler query = new StringBundler(2);
2853
2854 query.append(_SQL_COUNT_ANNOUNCEMENTSENTRY_WHERE);
2855
2856 query.append(_FINDER_COLUMN_USERID_USERID_2);
2857
2858 String sql = query.toString();
2859
2860 Session session = null;
2861
2862 try {
2863 session = openSession();
2864
2865 Query q = session.createQuery(sql);
2866
2867 QueryPos qPos = QueryPos.getInstance(q);
2868
2869 qPos.add(userId);
2870
2871 count = (Long)q.uniqueResult();
2872
2873 finderCache.putResult(finderPath, finderArgs, count);
2874 }
2875 catch (Exception e) {
2876 finderCache.removeResult(finderPath, finderArgs);
2877
2878 throw processException(e);
2879 }
2880 finally {
2881 closeSession(session);
2882 }
2883 }
2884
2885 return count.intValue();
2886 }
2887
2888
2894 @Override
2895 public int filterCountByUserId(long userId) {
2896 if (!InlineSQLHelperUtil.isEnabled()) {
2897 return countByUserId(userId);
2898 }
2899
2900 StringBundler query = new StringBundler(2);
2901
2902 query.append(_FILTER_SQL_COUNT_ANNOUNCEMENTSENTRY_WHERE);
2903
2904 query.append(_FINDER_COLUMN_USERID_USERID_2);
2905
2906 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2907 AnnouncementsEntry.class.getName(),
2908 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
2909
2910 Session session = null;
2911
2912 try {
2913 session = openSession();
2914
2915 SQLQuery q = session.createSynchronizedSQLQuery(sql);
2916
2917 q.addScalar(COUNT_COLUMN_NAME,
2918 com.liferay.portal.kernel.dao.orm.Type.LONG);
2919
2920 QueryPos qPos = QueryPos.getInstance(q);
2921
2922 qPos.add(userId);
2923
2924 Long count = (Long)q.uniqueResult();
2925
2926 return count.intValue();
2927 }
2928 catch (Exception e) {
2929 throw processException(e);
2930 }
2931 finally {
2932 closeSession(session);
2933 }
2934 }
2935
2936 private static final String _FINDER_COLUMN_USERID_USERID_2 = "announcementsEntry.userId = ?";
2937 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_C_C = new FinderPath(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
2938 AnnouncementsEntryModelImpl.FINDER_CACHE_ENABLED,
2939 AnnouncementsEntryImpl.class,
2940 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByC_C",
2941 new String[] {
2942 Long.class.getName(), Long.class.getName(),
2943
2944 Integer.class.getName(), Integer.class.getName(),
2945 OrderByComparator.class.getName()
2946 });
2947 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C = new FinderPath(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
2948 AnnouncementsEntryModelImpl.FINDER_CACHE_ENABLED,
2949 AnnouncementsEntryImpl.class,
2950 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByC_C",
2951 new String[] { Long.class.getName(), Long.class.getName() },
2952 AnnouncementsEntryModelImpl.CLASSNAMEID_COLUMN_BITMASK |
2953 AnnouncementsEntryModelImpl.CLASSPK_COLUMN_BITMASK |
2954 AnnouncementsEntryModelImpl.PRIORITY_COLUMN_BITMASK |
2955 AnnouncementsEntryModelImpl.MODIFIEDDATE_COLUMN_BITMASK);
2956 public static final FinderPath FINDER_PATH_COUNT_BY_C_C = new FinderPath(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
2957 AnnouncementsEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
2958 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_C",
2959 new String[] { Long.class.getName(), Long.class.getName() });
2960
2961
2968 @Override
2969 public List<AnnouncementsEntry> findByC_C(long classNameId, long classPK) {
2970 return findByC_C(classNameId, classPK, QueryUtil.ALL_POS,
2971 QueryUtil.ALL_POS, null);
2972 }
2973
2974
2987 @Override
2988 public List<AnnouncementsEntry> findByC_C(long classNameId, long classPK,
2989 int start, int end) {
2990 return findByC_C(classNameId, classPK, start, end, null);
2991 }
2992
2993
3007 @Override
3008 public List<AnnouncementsEntry> findByC_C(long classNameId, long classPK,
3009 int start, int end,
3010 OrderByComparator<AnnouncementsEntry> orderByComparator) {
3011 return findByC_C(classNameId, classPK, start, end, orderByComparator,
3012 true);
3013 }
3014
3015
3030 @Override
3031 public List<AnnouncementsEntry> findByC_C(long classNameId, long classPK,
3032 int start, int end,
3033 OrderByComparator<AnnouncementsEntry> orderByComparator,
3034 boolean retrieveFromCache) {
3035 boolean pagination = true;
3036 FinderPath finderPath = null;
3037 Object[] finderArgs = null;
3038
3039 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
3040 (orderByComparator == null)) {
3041 pagination = false;
3042 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C;
3043 finderArgs = new Object[] { classNameId, classPK };
3044 }
3045 else {
3046 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_C;
3047 finderArgs = new Object[] {
3048 classNameId, classPK,
3049
3050 start, end, orderByComparator
3051 };
3052 }
3053
3054 List<AnnouncementsEntry> list = null;
3055
3056 if (retrieveFromCache) {
3057 list = (List<AnnouncementsEntry>)finderCache.getResult(finderPath,
3058 finderArgs, this);
3059
3060 if ((list != null) && !list.isEmpty()) {
3061 for (AnnouncementsEntry announcementsEntry : list) {
3062 if ((classNameId != announcementsEntry.getClassNameId()) ||
3063 (classPK != announcementsEntry.getClassPK())) {
3064 list = null;
3065
3066 break;
3067 }
3068 }
3069 }
3070 }
3071
3072 if (list == null) {
3073 StringBundler query = null;
3074
3075 if (orderByComparator != null) {
3076 query = new StringBundler(4 +
3077 (orderByComparator.getOrderByFields().length * 3));
3078 }
3079 else {
3080 query = new StringBundler(4);
3081 }
3082
3083 query.append(_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
3084
3085 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
3086
3087 query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
3088
3089 if (orderByComparator != null) {
3090 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
3091 orderByComparator);
3092 }
3093 else
3094 if (pagination) {
3095 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
3096 }
3097
3098 String sql = query.toString();
3099
3100 Session session = null;
3101
3102 try {
3103 session = openSession();
3104
3105 Query q = session.createQuery(sql);
3106
3107 QueryPos qPos = QueryPos.getInstance(q);
3108
3109 qPos.add(classNameId);
3110
3111 qPos.add(classPK);
3112
3113 if (!pagination) {
3114 list = (List<AnnouncementsEntry>)QueryUtil.list(q,
3115 getDialect(), start, end, false);
3116
3117 Collections.sort(list);
3118
3119 list = Collections.unmodifiableList(list);
3120 }
3121 else {
3122 list = (List<AnnouncementsEntry>)QueryUtil.list(q,
3123 getDialect(), start, end);
3124 }
3125
3126 cacheResult(list);
3127
3128 finderCache.putResult(finderPath, finderArgs, list);
3129 }
3130 catch (Exception e) {
3131 finderCache.removeResult(finderPath, finderArgs);
3132
3133 throw processException(e);
3134 }
3135 finally {
3136 closeSession(session);
3137 }
3138 }
3139
3140 return list;
3141 }
3142
3143
3152 @Override
3153 public AnnouncementsEntry findByC_C_First(long classNameId, long classPK,
3154 OrderByComparator<AnnouncementsEntry> orderByComparator)
3155 throws NoSuchEntryException {
3156 AnnouncementsEntry announcementsEntry = fetchByC_C_First(classNameId,
3157 classPK, orderByComparator);
3158
3159 if (announcementsEntry != null) {
3160 return announcementsEntry;
3161 }
3162
3163 StringBundler msg = new StringBundler(6);
3164
3165 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3166
3167 msg.append("classNameId=");
3168 msg.append(classNameId);
3169
3170 msg.append(", classPK=");
3171 msg.append(classPK);
3172
3173 msg.append(StringPool.CLOSE_CURLY_BRACE);
3174
3175 throw new NoSuchEntryException(msg.toString());
3176 }
3177
3178
3186 @Override
3187 public AnnouncementsEntry fetchByC_C_First(long classNameId, long classPK,
3188 OrderByComparator<AnnouncementsEntry> orderByComparator) {
3189 List<AnnouncementsEntry> list = findByC_C(classNameId, classPK, 0, 1,
3190 orderByComparator);
3191
3192 if (!list.isEmpty()) {
3193 return list.get(0);
3194 }
3195
3196 return null;
3197 }
3198
3199
3208 @Override
3209 public AnnouncementsEntry findByC_C_Last(long classNameId, long classPK,
3210 OrderByComparator<AnnouncementsEntry> orderByComparator)
3211 throws NoSuchEntryException {
3212 AnnouncementsEntry announcementsEntry = fetchByC_C_Last(classNameId,
3213 classPK, orderByComparator);
3214
3215 if (announcementsEntry != null) {
3216 return announcementsEntry;
3217 }
3218
3219 StringBundler msg = new StringBundler(6);
3220
3221 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
3222
3223 msg.append("classNameId=");
3224 msg.append(classNameId);
3225
3226 msg.append(", classPK=");
3227 msg.append(classPK);
3228
3229 msg.append(StringPool.CLOSE_CURLY_BRACE);
3230
3231 throw new NoSuchEntryException(msg.toString());
3232 }
3233
3234
3242 @Override
3243 public AnnouncementsEntry fetchByC_C_Last(long classNameId, long classPK,
3244 OrderByComparator<AnnouncementsEntry> orderByComparator) {
3245 int count = countByC_C(classNameId, classPK);
3246
3247 if (count == 0) {
3248 return null;
3249 }
3250
3251 List<AnnouncementsEntry> list = findByC_C(classNameId, classPK,
3252 count - 1, count, orderByComparator);
3253
3254 if (!list.isEmpty()) {
3255 return list.get(0);
3256 }
3257
3258 return null;
3259 }
3260
3261
3271 @Override
3272 public AnnouncementsEntry[] findByC_C_PrevAndNext(long entryId,
3273 long classNameId, long classPK,
3274 OrderByComparator<AnnouncementsEntry> orderByComparator)
3275 throws NoSuchEntryException {
3276 AnnouncementsEntry announcementsEntry = findByPrimaryKey(entryId);
3277
3278 Session session = null;
3279
3280 try {
3281 session = openSession();
3282
3283 AnnouncementsEntry[] array = new AnnouncementsEntryImpl[3];
3284
3285 array[0] = getByC_C_PrevAndNext(session, announcementsEntry,
3286 classNameId, classPK, orderByComparator, true);
3287
3288 array[1] = announcementsEntry;
3289
3290 array[2] = getByC_C_PrevAndNext(session, announcementsEntry,
3291 classNameId, classPK, orderByComparator, false);
3292
3293 return array;
3294 }
3295 catch (Exception e) {
3296 throw processException(e);
3297 }
3298 finally {
3299 closeSession(session);
3300 }
3301 }
3302
3303 protected AnnouncementsEntry getByC_C_PrevAndNext(Session session,
3304 AnnouncementsEntry announcementsEntry, long classNameId, long classPK,
3305 OrderByComparator<AnnouncementsEntry> orderByComparator,
3306 boolean previous) {
3307 StringBundler query = null;
3308
3309 if (orderByComparator != null) {
3310 query = new StringBundler(6 +
3311 (orderByComparator.getOrderByFields().length * 6));
3312 }
3313 else {
3314 query = new StringBundler(3);
3315 }
3316
3317 query.append(_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
3318
3319 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
3320
3321 query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
3322
3323 if (orderByComparator != null) {
3324 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
3325
3326 if (orderByConditionFields.length > 0) {
3327 query.append(WHERE_AND);
3328 }
3329
3330 for (int i = 0; i < orderByConditionFields.length; i++) {
3331 query.append(_ORDER_BY_ENTITY_ALIAS);
3332 query.append(orderByConditionFields[i]);
3333
3334 if ((i + 1) < orderByConditionFields.length) {
3335 if (orderByComparator.isAscending() ^ previous) {
3336 query.append(WHERE_GREATER_THAN_HAS_NEXT);
3337 }
3338 else {
3339 query.append(WHERE_LESSER_THAN_HAS_NEXT);
3340 }
3341 }
3342 else {
3343 if (orderByComparator.isAscending() ^ previous) {
3344 query.append(WHERE_GREATER_THAN);
3345 }
3346 else {
3347 query.append(WHERE_LESSER_THAN);
3348 }
3349 }
3350 }
3351
3352 query.append(ORDER_BY_CLAUSE);
3353
3354 String[] orderByFields = orderByComparator.getOrderByFields();
3355
3356 for (int i = 0; i < orderByFields.length; i++) {
3357 query.append(_ORDER_BY_ENTITY_ALIAS);
3358 query.append(orderByFields[i]);
3359
3360 if ((i + 1) < orderByFields.length) {
3361 if (orderByComparator.isAscending() ^ previous) {
3362 query.append(ORDER_BY_ASC_HAS_NEXT);
3363 }
3364 else {
3365 query.append(ORDER_BY_DESC_HAS_NEXT);
3366 }
3367 }
3368 else {
3369 if (orderByComparator.isAscending() ^ previous) {
3370 query.append(ORDER_BY_ASC);
3371 }
3372 else {
3373 query.append(ORDER_BY_DESC);
3374 }
3375 }
3376 }
3377 }
3378 else {
3379 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
3380 }
3381
3382 String sql = query.toString();
3383
3384 Query q = session.createQuery(sql);
3385
3386 q.setFirstResult(0);
3387 q.setMaxResults(2);
3388
3389 QueryPos qPos = QueryPos.getInstance(q);
3390
3391 qPos.add(classNameId);
3392
3393 qPos.add(classPK);
3394
3395 if (orderByComparator != null) {
3396 Object[] values = orderByComparator.getOrderByConditionValues(announcementsEntry);
3397
3398 for (Object value : values) {
3399 qPos.add(value);
3400 }
3401 }
3402
3403 List<AnnouncementsEntry> list = q.list();
3404
3405 if (list.size() == 2) {
3406 return list.get(1);
3407 }
3408 else {
3409 return null;
3410 }
3411 }
3412
3413
3420 @Override
3421 public List<AnnouncementsEntry> filterFindByC_C(long classNameId,
3422 long classPK) {
3423 return filterFindByC_C(classNameId, classPK, QueryUtil.ALL_POS,
3424 QueryUtil.ALL_POS, null);
3425 }
3426
3427
3440 @Override
3441 public List<AnnouncementsEntry> filterFindByC_C(long classNameId,
3442 long classPK, int start, int end) {
3443 return filterFindByC_C(classNameId, classPK, start, end, null);
3444 }
3445
3446
3460 @Override
3461 public List<AnnouncementsEntry> filterFindByC_C(long classNameId,
3462 long classPK, int start, int end,
3463 OrderByComparator<AnnouncementsEntry> orderByComparator) {
3464 if (!InlineSQLHelperUtil.isEnabled()) {
3465 return findByC_C(classNameId, classPK, start, end, orderByComparator);
3466 }
3467
3468 StringBundler query = null;
3469
3470 if (orderByComparator != null) {
3471 query = new StringBundler(4 +
3472 (orderByComparator.getOrderByFields().length * 3));
3473 }
3474 else {
3475 query = new StringBundler(4);
3476 }
3477
3478 if (getDB().isSupportsInlineDistinct()) {
3479 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
3480 }
3481 else {
3482 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_1);
3483 }
3484
3485 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
3486
3487 query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
3488
3489 if (!getDB().isSupportsInlineDistinct()) {
3490 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_2);
3491 }
3492
3493 if (orderByComparator != null) {
3494 if (getDB().isSupportsInlineDistinct()) {
3495 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
3496 orderByComparator, true);
3497 }
3498 else {
3499 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
3500 orderByComparator, true);
3501 }
3502 }
3503 else {
3504 if (getDB().isSupportsInlineDistinct()) {
3505 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
3506 }
3507 else {
3508 query.append(AnnouncementsEntryModelImpl.ORDER_BY_SQL);
3509 }
3510 }
3511
3512 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3513 AnnouncementsEntry.class.getName(),
3514 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
3515
3516 Session session = null;
3517
3518 try {
3519 session = openSession();
3520
3521 SQLQuery q = session.createSynchronizedSQLQuery(sql);
3522
3523 if (getDB().isSupportsInlineDistinct()) {
3524 q.addEntity(_FILTER_ENTITY_ALIAS, AnnouncementsEntryImpl.class);
3525 }
3526 else {
3527 q.addEntity(_FILTER_ENTITY_TABLE, AnnouncementsEntryImpl.class);
3528 }
3529
3530 QueryPos qPos = QueryPos.getInstance(q);
3531
3532 qPos.add(classNameId);
3533
3534 qPos.add(classPK);
3535
3536 return (List<AnnouncementsEntry>)QueryUtil.list(q, getDialect(),
3537 start, end);
3538 }
3539 catch (Exception e) {
3540 throw processException(e);
3541 }
3542 finally {
3543 closeSession(session);
3544 }
3545 }
3546
3547
3557 @Override
3558 public AnnouncementsEntry[] filterFindByC_C_PrevAndNext(long entryId,
3559 long classNameId, long classPK,
3560 OrderByComparator<AnnouncementsEntry> orderByComparator)
3561 throws NoSuchEntryException {
3562 if (!InlineSQLHelperUtil.isEnabled()) {
3563 return findByC_C_PrevAndNext(entryId, classNameId, classPK,
3564 orderByComparator);
3565 }
3566
3567 AnnouncementsEntry announcementsEntry = findByPrimaryKey(entryId);
3568
3569 Session session = null;
3570
3571 try {
3572 session = openSession();
3573
3574 AnnouncementsEntry[] array = new AnnouncementsEntryImpl[3];
3575
3576 array[0] = filterGetByC_C_PrevAndNext(session, announcementsEntry,
3577 classNameId, classPK, orderByComparator, true);
3578
3579 array[1] = announcementsEntry;
3580
3581 array[2] = filterGetByC_C_PrevAndNext(session, announcementsEntry,
3582 classNameId, classPK, orderByComparator, false);
3583
3584 return array;
3585 }
3586 catch (Exception e) {
3587 throw processException(e);
3588 }
3589 finally {
3590 closeSession(session);
3591 }
3592 }
3593
3594 protected AnnouncementsEntry filterGetByC_C_PrevAndNext(Session session,
3595 AnnouncementsEntry announcementsEntry, long classNameId, long classPK,
3596 OrderByComparator<AnnouncementsEntry> orderByComparator,
3597 boolean previous) {
3598 StringBundler query = null;
3599
3600 if (orderByComparator != null) {
3601 query = new StringBundler(6 +
3602 (orderByComparator.getOrderByFields().length * 6));
3603 }
3604 else {
3605 query = new StringBundler(3);
3606 }
3607
3608 if (getDB().isSupportsInlineDistinct()) {
3609 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
3610 }
3611 else {
3612 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_1);
3613 }
3614
3615 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
3616
3617 query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
3618
3619 if (!getDB().isSupportsInlineDistinct()) {
3620 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_2);
3621 }
3622
3623 if (orderByComparator != null) {
3624 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
3625
3626 if (orderByConditionFields.length > 0) {
3627 query.append(WHERE_AND);
3628 }
3629
3630 for (int i = 0; i < orderByConditionFields.length; i++) {
3631 if (getDB().isSupportsInlineDistinct()) {
3632 query.append(_ORDER_BY_ENTITY_ALIAS);
3633 }
3634 else {
3635 query.append(_ORDER_BY_ENTITY_TABLE);
3636 }
3637
3638 query.append(orderByConditionFields[i]);
3639
3640 if ((i + 1) < orderByConditionFields.length) {
3641 if (orderByComparator.isAscending() ^ previous) {
3642 query.append(WHERE_GREATER_THAN_HAS_NEXT);
3643 }
3644 else {
3645 query.append(WHERE_LESSER_THAN_HAS_NEXT);
3646 }
3647 }
3648 else {
3649 if (orderByComparator.isAscending() ^ previous) {
3650 query.append(WHERE_GREATER_THAN);
3651 }
3652 else {
3653 query.append(WHERE_LESSER_THAN);
3654 }
3655 }
3656 }
3657
3658 query.append(ORDER_BY_CLAUSE);
3659
3660 String[] orderByFields = orderByComparator.getOrderByFields();
3661
3662 for (int i = 0; i < orderByFields.length; i++) {
3663 if (getDB().isSupportsInlineDistinct()) {
3664 query.append(_ORDER_BY_ENTITY_ALIAS);
3665 }
3666 else {
3667 query.append(_ORDER_BY_ENTITY_TABLE);
3668 }
3669
3670 query.append(orderByFields[i]);
3671
3672 if ((i + 1) < orderByFields.length) {
3673 if (orderByComparator.isAscending() ^ previous) {
3674 query.append(ORDER_BY_ASC_HAS_NEXT);
3675 }
3676 else {
3677 query.append(ORDER_BY_DESC_HAS_NEXT);
3678 }
3679 }
3680 else {
3681 if (orderByComparator.isAscending() ^ previous) {
3682 query.append(ORDER_BY_ASC);
3683 }
3684 else {
3685 query.append(ORDER_BY_DESC);
3686 }
3687 }
3688 }
3689 }
3690 else {
3691 if (getDB().isSupportsInlineDistinct()) {
3692 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
3693 }
3694 else {
3695 query.append(AnnouncementsEntryModelImpl.ORDER_BY_SQL);
3696 }
3697 }
3698
3699 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3700 AnnouncementsEntry.class.getName(),
3701 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
3702
3703 SQLQuery q = session.createSynchronizedSQLQuery(sql);
3704
3705 q.setFirstResult(0);
3706 q.setMaxResults(2);
3707
3708 if (getDB().isSupportsInlineDistinct()) {
3709 q.addEntity(_FILTER_ENTITY_ALIAS, AnnouncementsEntryImpl.class);
3710 }
3711 else {
3712 q.addEntity(_FILTER_ENTITY_TABLE, AnnouncementsEntryImpl.class);
3713 }
3714
3715 QueryPos qPos = QueryPos.getInstance(q);
3716
3717 qPos.add(classNameId);
3718
3719 qPos.add(classPK);
3720
3721 if (orderByComparator != null) {
3722 Object[] values = orderByComparator.getOrderByConditionValues(announcementsEntry);
3723
3724 for (Object value : values) {
3725 qPos.add(value);
3726 }
3727 }
3728
3729 List<AnnouncementsEntry> list = q.list();
3730
3731 if (list.size() == 2) {
3732 return list.get(1);
3733 }
3734 else {
3735 return null;
3736 }
3737 }
3738
3739
3745 @Override
3746 public void removeByC_C(long classNameId, long classPK) {
3747 for (AnnouncementsEntry announcementsEntry : findByC_C(classNameId,
3748 classPK, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
3749 remove(announcementsEntry);
3750 }
3751 }
3752
3753
3760 @Override
3761 public int countByC_C(long classNameId, long classPK) {
3762 FinderPath finderPath = FINDER_PATH_COUNT_BY_C_C;
3763
3764 Object[] finderArgs = new Object[] { classNameId, classPK };
3765
3766 Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);
3767
3768 if (count == null) {
3769 StringBundler query = new StringBundler(3);
3770
3771 query.append(_SQL_COUNT_ANNOUNCEMENTSENTRY_WHERE);
3772
3773 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
3774
3775 query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
3776
3777 String sql = query.toString();
3778
3779 Session session = null;
3780
3781 try {
3782 session = openSession();
3783
3784 Query q = session.createQuery(sql);
3785
3786 QueryPos qPos = QueryPos.getInstance(q);
3787
3788 qPos.add(classNameId);
3789
3790 qPos.add(classPK);
3791
3792 count = (Long)q.uniqueResult();
3793
3794 finderCache.putResult(finderPath, finderArgs, count);
3795 }
3796 catch (Exception e) {
3797 finderCache.removeResult(finderPath, finderArgs);
3798
3799 throw processException(e);
3800 }
3801 finally {
3802 closeSession(session);
3803 }
3804 }
3805
3806 return count.intValue();
3807 }
3808
3809
3816 @Override
3817 public int filterCountByC_C(long classNameId, long classPK) {
3818 if (!InlineSQLHelperUtil.isEnabled()) {
3819 return countByC_C(classNameId, classPK);
3820 }
3821
3822 StringBundler query = new StringBundler(3);
3823
3824 query.append(_FILTER_SQL_COUNT_ANNOUNCEMENTSENTRY_WHERE);
3825
3826 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
3827
3828 query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
3829
3830 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3831 AnnouncementsEntry.class.getName(),
3832 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
3833
3834 Session session = null;
3835
3836 try {
3837 session = openSession();
3838
3839 SQLQuery q = session.createSynchronizedSQLQuery(sql);
3840
3841 q.addScalar(COUNT_COLUMN_NAME,
3842 com.liferay.portal.kernel.dao.orm.Type.LONG);
3843
3844 QueryPos qPos = QueryPos.getInstance(q);
3845
3846 qPos.add(classNameId);
3847
3848 qPos.add(classPK);
3849
3850 Long count = (Long)q.uniqueResult();
3851
3852 return count.intValue();
3853 }
3854 catch (Exception e) {
3855 throw processException(e);
3856 }
3857 finally {
3858 closeSession(session);
3859 }
3860 }
3861
3862 private static final String _FINDER_COLUMN_C_C_CLASSNAMEID_2 = "announcementsEntry.classNameId = ? AND ";
3863 private static final String _FINDER_COLUMN_C_C_CLASSPK_2 = "announcementsEntry.classPK = ?";
3864 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_C_C_A = new FinderPath(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
3865 AnnouncementsEntryModelImpl.FINDER_CACHE_ENABLED,
3866 AnnouncementsEntryImpl.class,
3867 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByC_C_A",
3868 new String[] {
3869 Long.class.getName(), Long.class.getName(),
3870 Boolean.class.getName(),
3871
3872 Integer.class.getName(), Integer.class.getName(),
3873 OrderByComparator.class.getName()
3874 });
3875 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_A = new FinderPath(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
3876 AnnouncementsEntryModelImpl.FINDER_CACHE_ENABLED,
3877 AnnouncementsEntryImpl.class,
3878 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByC_C_A",
3879 new String[] {
3880 Long.class.getName(), Long.class.getName(),
3881 Boolean.class.getName()
3882 },
3883 AnnouncementsEntryModelImpl.CLASSNAMEID_COLUMN_BITMASK |
3884 AnnouncementsEntryModelImpl.CLASSPK_COLUMN_BITMASK |
3885 AnnouncementsEntryModelImpl.ALERT_COLUMN_BITMASK |
3886 AnnouncementsEntryModelImpl.PRIORITY_COLUMN_BITMASK |
3887 AnnouncementsEntryModelImpl.MODIFIEDDATE_COLUMN_BITMASK);
3888 public static final FinderPath FINDER_PATH_COUNT_BY_C_C_A = new FinderPath(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
3889 AnnouncementsEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
3890 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_C_A",
3891 new String[] {
3892 Long.class.getName(), Long.class.getName(),
3893 Boolean.class.getName()
3894 });
3895
3896
3904 @Override
3905 public List<AnnouncementsEntry> findByC_C_A(long classNameId, long classPK,
3906 boolean alert) {
3907 return findByC_C_A(classNameId, classPK, alert, QueryUtil.ALL_POS,
3908 QueryUtil.ALL_POS, null);
3909 }
3910
3911
3925 @Override
3926 public List<AnnouncementsEntry> findByC_C_A(long classNameId, long classPK,
3927 boolean alert, int start, int end) {
3928 return findByC_C_A(classNameId, classPK, alert, start, end, null);
3929 }
3930
3931
3946 @Override
3947 public List<AnnouncementsEntry> findByC_C_A(long classNameId, long classPK,
3948 boolean alert, int start, int end,
3949 OrderByComparator<AnnouncementsEntry> orderByComparator) {
3950 return findByC_C_A(classNameId, classPK, alert, start, end,
3951 orderByComparator, true);
3952 }
3953
3954
3970 @Override
3971 public List<AnnouncementsEntry> findByC_C_A(long classNameId, long classPK,
3972 boolean alert, int start, int end,
3973 OrderByComparator<AnnouncementsEntry> orderByComparator,
3974 boolean retrieveFromCache) {
3975 boolean pagination = true;
3976 FinderPath finderPath = null;
3977 Object[] finderArgs = null;
3978
3979 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
3980 (orderByComparator == null)) {
3981 pagination = false;
3982 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_A;
3983 finderArgs = new Object[] { classNameId, classPK, alert };
3984 }
3985 else {
3986 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_C_A;
3987 finderArgs = new Object[] {
3988 classNameId, classPK, alert,
3989
3990 start, end, orderByComparator
3991 };
3992 }
3993
3994 List<AnnouncementsEntry> list = null;
3995
3996 if (retrieveFromCache) {
3997 list = (List<AnnouncementsEntry>)finderCache.getResult(finderPath,
3998 finderArgs, this);
3999
4000 if ((list != null) && !list.isEmpty()) {
4001 for (AnnouncementsEntry announcementsEntry : list) {
4002 if ((classNameId != announcementsEntry.getClassNameId()) ||
4003 (classPK != announcementsEntry.getClassPK()) ||
4004 (alert != announcementsEntry.getAlert())) {
4005 list = null;
4006
4007 break;
4008 }
4009 }
4010 }
4011 }
4012
4013 if (list == null) {
4014 StringBundler query = null;
4015
4016 if (orderByComparator != null) {
4017 query = new StringBundler(5 +
4018 (orderByComparator.getOrderByFields().length * 3));
4019 }
4020 else {
4021 query = new StringBundler(5);
4022 }
4023
4024 query.append(_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
4025
4026 query.append(_FINDER_COLUMN_C_C_A_CLASSNAMEID_2);
4027
4028 query.append(_FINDER_COLUMN_C_C_A_CLASSPK_2);
4029
4030 query.append(_FINDER_COLUMN_C_C_A_ALERT_2);
4031
4032 if (orderByComparator != null) {
4033 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
4034 orderByComparator);
4035 }
4036 else
4037 if (pagination) {
4038 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
4039 }
4040
4041 String sql = query.toString();
4042
4043 Session session = null;
4044
4045 try {
4046 session = openSession();
4047
4048 Query q = session.createQuery(sql);
4049
4050 QueryPos qPos = QueryPos.getInstance(q);
4051
4052 qPos.add(classNameId);
4053
4054 qPos.add(classPK);
4055
4056 qPos.add(alert);
4057
4058 if (!pagination) {
4059 list = (List<AnnouncementsEntry>)QueryUtil.list(q,
4060 getDialect(), start, end, false);
4061
4062 Collections.sort(list);
4063
4064 list = Collections.unmodifiableList(list);
4065 }
4066 else {
4067 list = (List<AnnouncementsEntry>)QueryUtil.list(q,
4068 getDialect(), start, end);
4069 }
4070
4071 cacheResult(list);
4072
4073 finderCache.putResult(finderPath, finderArgs, list);
4074 }
4075 catch (Exception e) {
4076 finderCache.removeResult(finderPath, finderArgs);
4077
4078 throw processException(e);
4079 }
4080 finally {
4081 closeSession(session);
4082 }
4083 }
4084
4085 return list;
4086 }
4087
4088
4098 @Override
4099 public AnnouncementsEntry findByC_C_A_First(long classNameId, long classPK,
4100 boolean alert, OrderByComparator<AnnouncementsEntry> orderByComparator)
4101 throws NoSuchEntryException {
4102 AnnouncementsEntry announcementsEntry = fetchByC_C_A_First(classNameId,
4103 classPK, alert, orderByComparator);
4104
4105 if (announcementsEntry != null) {
4106 return announcementsEntry;
4107 }
4108
4109 StringBundler msg = new StringBundler(8);
4110
4111 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
4112
4113 msg.append("classNameId=");
4114 msg.append(classNameId);
4115
4116 msg.append(", classPK=");
4117 msg.append(classPK);
4118
4119 msg.append(", alert=");
4120 msg.append(alert);
4121
4122 msg.append(StringPool.CLOSE_CURLY_BRACE);
4123
4124 throw new NoSuchEntryException(msg.toString());
4125 }
4126
4127
4136 @Override
4137 public AnnouncementsEntry fetchByC_C_A_First(long classNameId,
4138 long classPK, boolean alert,
4139 OrderByComparator<AnnouncementsEntry> orderByComparator) {
4140 List<AnnouncementsEntry> list = findByC_C_A(classNameId, classPK,
4141 alert, 0, 1, orderByComparator);
4142
4143 if (!list.isEmpty()) {
4144 return list.get(0);
4145 }
4146
4147 return null;
4148 }
4149
4150
4160 @Override
4161 public AnnouncementsEntry findByC_C_A_Last(long classNameId, long classPK,
4162 boolean alert, OrderByComparator<AnnouncementsEntry> orderByComparator)
4163 throws NoSuchEntryException {
4164 AnnouncementsEntry announcementsEntry = fetchByC_C_A_Last(classNameId,
4165 classPK, alert, orderByComparator);
4166
4167 if (announcementsEntry != null) {
4168 return announcementsEntry;
4169 }
4170
4171 StringBundler msg = new StringBundler(8);
4172
4173 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
4174
4175 msg.append("classNameId=");
4176 msg.append(classNameId);
4177
4178 msg.append(", classPK=");
4179 msg.append(classPK);
4180
4181 msg.append(", alert=");
4182 msg.append(alert);
4183
4184 msg.append(StringPool.CLOSE_CURLY_BRACE);
4185
4186 throw new NoSuchEntryException(msg.toString());
4187 }
4188
4189
4198 @Override
4199 public AnnouncementsEntry fetchByC_C_A_Last(long classNameId, long classPK,
4200 boolean alert, OrderByComparator<AnnouncementsEntry> orderByComparator) {
4201 int count = countByC_C_A(classNameId, classPK, alert);
4202
4203 if (count == 0) {
4204 return null;
4205 }
4206
4207 List<AnnouncementsEntry> list = findByC_C_A(classNameId, classPK,
4208 alert, count - 1, count, orderByComparator);
4209
4210 if (!list.isEmpty()) {
4211 return list.get(0);
4212 }
4213
4214 return null;
4215 }
4216
4217
4228 @Override
4229 public AnnouncementsEntry[] findByC_C_A_PrevAndNext(long entryId,
4230 long classNameId, long classPK, boolean alert,
4231 OrderByComparator<AnnouncementsEntry> orderByComparator)
4232 throws NoSuchEntryException {
4233 AnnouncementsEntry announcementsEntry = findByPrimaryKey(entryId);
4234
4235 Session session = null;
4236
4237 try {
4238 session = openSession();
4239
4240 AnnouncementsEntry[] array = new AnnouncementsEntryImpl[3];
4241
4242 array[0] = getByC_C_A_PrevAndNext(session, announcementsEntry,
4243 classNameId, classPK, alert, orderByComparator, true);
4244
4245 array[1] = announcementsEntry;
4246
4247 array[2] = getByC_C_A_PrevAndNext(session, announcementsEntry,
4248 classNameId, classPK, alert, orderByComparator, false);
4249
4250 return array;
4251 }
4252 catch (Exception e) {
4253 throw processException(e);
4254 }
4255 finally {
4256 closeSession(session);
4257 }
4258 }
4259
4260 protected AnnouncementsEntry getByC_C_A_PrevAndNext(Session session,
4261 AnnouncementsEntry announcementsEntry, long classNameId, long classPK,
4262 boolean alert, OrderByComparator<AnnouncementsEntry> orderByComparator,
4263 boolean previous) {
4264 StringBundler query = null;
4265
4266 if (orderByComparator != null) {
4267 query = new StringBundler(6 +
4268 (orderByComparator.getOrderByFields().length * 6));
4269 }
4270 else {
4271 query = new StringBundler(3);
4272 }
4273
4274 query.append(_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
4275
4276 query.append(_FINDER_COLUMN_C_C_A_CLASSNAMEID_2);
4277
4278 query.append(_FINDER_COLUMN_C_C_A_CLASSPK_2);
4279
4280 query.append(_FINDER_COLUMN_C_C_A_ALERT_2);
4281
4282 if (orderByComparator != null) {
4283 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
4284
4285 if (orderByConditionFields.length > 0) {
4286 query.append(WHERE_AND);
4287 }
4288
4289 for (int i = 0; i < orderByConditionFields.length; i++) {
4290 query.append(_ORDER_BY_ENTITY_ALIAS);
4291 query.append(orderByConditionFields[i]);
4292
4293 if ((i + 1) < orderByConditionFields.length) {
4294 if (orderByComparator.isAscending() ^ previous) {
4295 query.append(WHERE_GREATER_THAN_HAS_NEXT);
4296 }
4297 else {
4298 query.append(WHERE_LESSER_THAN_HAS_NEXT);
4299 }
4300 }
4301 else {
4302 if (orderByComparator.isAscending() ^ previous) {
4303 query.append(WHERE_GREATER_THAN);
4304 }
4305 else {
4306 query.append(WHERE_LESSER_THAN);
4307 }
4308 }
4309 }
4310
4311 query.append(ORDER_BY_CLAUSE);
4312
4313 String[] orderByFields = orderByComparator.getOrderByFields();
4314
4315 for (int i = 0; i < orderByFields.length; i++) {
4316 query.append(_ORDER_BY_ENTITY_ALIAS);
4317 query.append(orderByFields[i]);
4318
4319 if ((i + 1) < orderByFields.length) {
4320 if (orderByComparator.isAscending() ^ previous) {
4321 query.append(ORDER_BY_ASC_HAS_NEXT);
4322 }
4323 else {
4324 query.append(ORDER_BY_DESC_HAS_NEXT);
4325 }
4326 }
4327 else {
4328 if (orderByComparator.isAscending() ^ previous) {
4329 query.append(ORDER_BY_ASC);
4330 }
4331 else {
4332 query.append(ORDER_BY_DESC);
4333 }
4334 }
4335 }
4336 }
4337 else {
4338 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
4339 }
4340
4341 String sql = query.toString();
4342
4343 Query q = session.createQuery(sql);
4344
4345 q.setFirstResult(0);
4346 q.setMaxResults(2);
4347
4348 QueryPos qPos = QueryPos.getInstance(q);
4349
4350 qPos.add(classNameId);
4351
4352 qPos.add(classPK);
4353
4354 qPos.add(alert);
4355
4356 if (orderByComparator != null) {
4357 Object[] values = orderByComparator.getOrderByConditionValues(announcementsEntry);
4358
4359 for (Object value : values) {
4360 qPos.add(value);
4361 }
4362 }
4363
4364 List<AnnouncementsEntry> list = q.list();
4365
4366 if (list.size() == 2) {
4367 return list.get(1);
4368 }
4369 else {
4370 return null;
4371 }
4372 }
4373
4374
4382 @Override
4383 public List<AnnouncementsEntry> filterFindByC_C_A(long classNameId,
4384 long classPK, boolean alert) {
4385 return filterFindByC_C_A(classNameId, classPK, alert,
4386 QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
4387 }
4388
4389
4403 @Override
4404 public List<AnnouncementsEntry> filterFindByC_C_A(long classNameId,
4405 long classPK, boolean alert, int start, int end) {
4406 return filterFindByC_C_A(classNameId, classPK, alert, start, end, null);
4407 }
4408
4409
4424 @Override
4425 public List<AnnouncementsEntry> filterFindByC_C_A(long classNameId,
4426 long classPK, boolean alert, int start, int end,
4427 OrderByComparator<AnnouncementsEntry> orderByComparator) {
4428 if (!InlineSQLHelperUtil.isEnabled()) {
4429 return findByC_C_A(classNameId, classPK, alert, start, end,
4430 orderByComparator);
4431 }
4432
4433 StringBundler query = null;
4434
4435 if (orderByComparator != null) {
4436 query = new StringBundler(5 +
4437 (orderByComparator.getOrderByFields().length * 3));
4438 }
4439 else {
4440 query = new StringBundler(5);
4441 }
4442
4443 if (getDB().isSupportsInlineDistinct()) {
4444 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
4445 }
4446 else {
4447 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_1);
4448 }
4449
4450 query.append(_FINDER_COLUMN_C_C_A_CLASSNAMEID_2);
4451
4452 query.append(_FINDER_COLUMN_C_C_A_CLASSPK_2);
4453
4454 query.append(_FINDER_COLUMN_C_C_A_ALERT_2);
4455
4456 if (!getDB().isSupportsInlineDistinct()) {
4457 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_2);
4458 }
4459
4460 if (orderByComparator != null) {
4461 if (getDB().isSupportsInlineDistinct()) {
4462 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
4463 orderByComparator, true);
4464 }
4465 else {
4466 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
4467 orderByComparator, true);
4468 }
4469 }
4470 else {
4471 if (getDB().isSupportsInlineDistinct()) {
4472 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
4473 }
4474 else {
4475 query.append(AnnouncementsEntryModelImpl.ORDER_BY_SQL);
4476 }
4477 }
4478
4479 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
4480 AnnouncementsEntry.class.getName(),
4481 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
4482
4483 Session session = null;
4484
4485 try {
4486 session = openSession();
4487
4488 SQLQuery q = session.createSynchronizedSQLQuery(sql);
4489
4490 if (getDB().isSupportsInlineDistinct()) {
4491 q.addEntity(_FILTER_ENTITY_ALIAS, AnnouncementsEntryImpl.class);
4492 }
4493 else {
4494 q.addEntity(_FILTER_ENTITY_TABLE, AnnouncementsEntryImpl.class);
4495 }
4496
4497 QueryPos qPos = QueryPos.getInstance(q);
4498
4499 qPos.add(classNameId);
4500
4501 qPos.add(classPK);
4502
4503 qPos.add(alert);
4504
4505 return (List<AnnouncementsEntry>)QueryUtil.list(q, getDialect(),
4506 start, end);
4507 }
4508 catch (Exception e) {
4509 throw processException(e);
4510 }
4511 finally {
4512 closeSession(session);
4513 }
4514 }
4515
4516
4527 @Override
4528 public AnnouncementsEntry[] filterFindByC_C_A_PrevAndNext(long entryId,
4529 long classNameId, long classPK, boolean alert,
4530 OrderByComparator<AnnouncementsEntry> orderByComparator)
4531 throws NoSuchEntryException {
4532 if (!InlineSQLHelperUtil.isEnabled()) {
4533 return findByC_C_A_PrevAndNext(entryId, classNameId, classPK,
4534 alert, orderByComparator);
4535 }
4536
4537 AnnouncementsEntry announcementsEntry = findByPrimaryKey(entryId);
4538
4539 Session session = null;
4540
4541 try {
4542 session = openSession();
4543
4544 AnnouncementsEntry[] array = new AnnouncementsEntryImpl[3];
4545
4546 array[0] = filterGetByC_C_A_PrevAndNext(session,
4547 announcementsEntry, classNameId, classPK, alert,
4548 orderByComparator, true);
4549
4550 array[1] = announcementsEntry;
4551
4552 array[2] = filterGetByC_C_A_PrevAndNext(session,
4553 announcementsEntry, classNameId, classPK, alert,
4554 orderByComparator, false);
4555
4556 return array;
4557 }
4558 catch (Exception e) {
4559 throw processException(e);
4560 }
4561 finally {
4562 closeSession(session);
4563 }
4564 }
4565
4566 protected AnnouncementsEntry filterGetByC_C_A_PrevAndNext(Session session,
4567 AnnouncementsEntry announcementsEntry, long classNameId, long classPK,
4568 boolean alert, OrderByComparator<AnnouncementsEntry> orderByComparator,
4569 boolean previous) {
4570 StringBundler query = null;
4571
4572 if (orderByComparator != null) {
4573 query = new StringBundler(6 +
4574 (orderByComparator.getOrderByFields().length * 6));
4575 }
4576 else {
4577 query = new StringBundler(3);
4578 }
4579
4580 if (getDB().isSupportsInlineDistinct()) {
4581 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
4582 }
4583 else {
4584 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_1);
4585 }
4586
4587 query.append(_FINDER_COLUMN_C_C_A_CLASSNAMEID_2);
4588
4589 query.append(_FINDER_COLUMN_C_C_A_CLASSPK_2);
4590
4591 query.append(_FINDER_COLUMN_C_C_A_ALERT_2);
4592
4593 if (!getDB().isSupportsInlineDistinct()) {
4594 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_2);
4595 }
4596
4597 if (orderByComparator != null) {
4598 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
4599
4600 if (orderByConditionFields.length > 0) {
4601 query.append(WHERE_AND);
4602 }
4603
4604 for (int i = 0; i < orderByConditionFields.length; i++) {
4605 if (getDB().isSupportsInlineDistinct()) {
4606 query.append(_ORDER_BY_ENTITY_ALIAS);
4607 }
4608 else {
4609 query.append(_ORDER_BY_ENTITY_TABLE);
4610 }
4611
4612 query.append(orderByConditionFields[i]);
4613
4614 if ((i + 1) < orderByConditionFields.length) {
4615 if (orderByComparator.isAscending() ^ previous) {
4616 query.append(WHERE_GREATER_THAN_HAS_NEXT);
4617 }
4618 else {
4619 query.append(WHERE_LESSER_THAN_HAS_NEXT);
4620 }
4621 }
4622 else {
4623 if (orderByComparator.isAscending() ^ previous) {
4624 query.append(WHERE_GREATER_THAN);
4625 }
4626 else {
4627 query.append(WHERE_LESSER_THAN);
4628 }
4629 }
4630 }
4631
4632 query.append(ORDER_BY_CLAUSE);
4633
4634 String[] orderByFields = orderByComparator.getOrderByFields();
4635
4636 for (int i = 0; i < orderByFields.length; i++) {
4637 if (getDB().isSupportsInlineDistinct()) {
4638 query.append(_ORDER_BY_ENTITY_ALIAS);
4639 }
4640 else {
4641 query.append(_ORDER_BY_ENTITY_TABLE);
4642 }
4643
4644 query.append(orderByFields[i]);
4645
4646 if ((i + 1) < orderByFields.length) {
4647 if (orderByComparator.isAscending() ^ previous) {
4648 query.append(ORDER_BY_ASC_HAS_NEXT);
4649 }
4650 else {
4651 query.append(ORDER_BY_DESC_HAS_NEXT);
4652 }
4653 }
4654 else {
4655 if (orderByComparator.isAscending() ^ previous) {
4656 query.append(ORDER_BY_ASC);
4657 }
4658 else {
4659 query.append(ORDER_BY_DESC);
4660 }
4661 }
4662 }
4663 }
4664 else {
4665 if (getDB().isSupportsInlineDistinct()) {
4666 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
4667 }
4668 else {
4669 query.append(AnnouncementsEntryModelImpl.ORDER_BY_SQL);
4670 }
4671 }
4672
4673 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
4674 AnnouncementsEntry.class.getName(),
4675 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
4676
4677 SQLQuery q = session.createSynchronizedSQLQuery(sql);
4678
4679 q.setFirstResult(0);
4680 q.setMaxResults(2);
4681
4682 if (getDB().isSupportsInlineDistinct()) {
4683 q.addEntity(_FILTER_ENTITY_ALIAS, AnnouncementsEntryImpl.class);
4684 }
4685 else {
4686 q.addEntity(_FILTER_ENTITY_TABLE, AnnouncementsEntryImpl.class);
4687 }
4688
4689 QueryPos qPos = QueryPos.getInstance(q);
4690
4691 qPos.add(classNameId);
4692
4693 qPos.add(classPK);
4694
4695 qPos.add(alert);
4696
4697 if (orderByComparator != null) {
4698 Object[] values = orderByComparator.getOrderByConditionValues(announcementsEntry);
4699
4700 for (Object value : values) {
4701 qPos.add(value);
4702 }
4703 }
4704
4705 List<AnnouncementsEntry> list = q.list();
4706
4707 if (list.size() == 2) {
4708 return list.get(1);
4709 }
4710 else {
4711 return null;
4712 }
4713 }
4714
4715
4722 @Override
4723 public void removeByC_C_A(long classNameId, long classPK, boolean alert) {
4724 for (AnnouncementsEntry announcementsEntry : findByC_C_A(classNameId,
4725 classPK, alert, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
4726 remove(announcementsEntry);
4727 }
4728 }
4729
4730
4738 @Override
4739 public int countByC_C_A(long classNameId, long classPK, boolean alert) {
4740 FinderPath finderPath = FINDER_PATH_COUNT_BY_C_C_A;
4741
4742 Object[] finderArgs = new Object[] { classNameId, classPK, alert };
4743
4744 Long count = (Long)finderCache.getResult(finderPath, finderArgs, this);
4745
4746 if (count == null) {
4747 StringBundler query = new StringBundler(4);
4748
4749 query.append(_SQL_COUNT_ANNOUNCEMENTSENTRY_WHERE);
4750
4751 query.append(_FINDER_COLUMN_C_C_A_CLASSNAMEID_2);
4752
4753 query.append(_FINDER_COLUMN_C_C_A_CLASSPK_2);
4754
4755 query.append(_FINDER_COLUMN_C_C_A_ALERT_2);
4756
4757 String sql = query.toString();
4758
4759 Session session = null;
4760
4761 try {
4762 session = openSession();
4763
4764 Query q = session.createQuery(sql);
4765
4766 QueryPos qPos = QueryPos.getInstance(q);
4767
4768 qPos.add(classNameId);
4769
4770 qPos.add(classPK);
4771
4772 qPos.add(alert);
4773
4774 count = (Long)q.uniqueResult();
4775
4776 finderCache.putResult(finderPath, finderArgs, count);
4777 }
4778 catch (Exception e) {
4779 finderCache.removeResult(finderPath, finderArgs);
4780
4781 throw processException(e);
4782 }
4783 finally {
4784 closeSession(session);
4785 }
4786 }
4787
4788 return count.intValue();
4789 }
4790
4791
4799 @Override
4800 public int filterCountByC_C_A(long classNameId, long classPK, boolean alert) {
4801 if (!InlineSQLHelperUtil.isEnabled()) {
4802 return countByC_C_A(classNameId, classPK, alert);
4803 }
4804
4805 StringBundler query = new StringBundler(4);
4806
4807 query.append(_FILTER_SQL_COUNT_ANNOUNCEMENTSENTRY_WHERE);
4808
4809 query.append(_FINDER_COLUMN_C_C_A_CLASSNAMEID_2);
4810
4811 query.append(_FINDER_COLUMN_C_C_A_CLASSPK_2);
4812
4813 query.append(_FINDER_COLUMN_C_C_A_ALERT_2);
4814
4815 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
4816 AnnouncementsEntry.class.getName(),
4817 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
4818
4819 Session session = null;
4820
4821 try {
4822 session = openSession();
4823
4824 SQLQuery q = session.createSynchronizedSQLQuery(sql);
4825
4826 q.addScalar(COUNT_COLUMN_NAME,
4827 com.liferay.portal.kernel.dao.orm.Type.LONG);
4828
4829 QueryPos qPos = QueryPos.getInstance(q);
4830
4831 qPos.add(classNameId);
4832
4833 qPos.add(classPK);
4834
4835 qPos.add(alert);
4836
4837 Long count = (Long)q.uniqueResult();
4838
4839 return count.intValue();
4840 }
4841 catch (Exception e) {
4842 throw processException(e);
4843 }
4844 finally {
4845 closeSession(session);
4846 }
4847 }
4848
4849 private static final String _FINDER_COLUMN_C_C_A_CLASSNAMEID_2 = "announcementsEntry.classNameId = ? AND ";
4850 private static final String _FINDER_COLUMN_C_C_A_CLASSPK_2 = "announcementsEntry.classPK = ? AND ";
4851 private static final String _FINDER_COLUMN_C_C_A_ALERT_2 = "announcementsEntry.alert = ?";
4852
4853 public AnnouncementsEntryPersistenceImpl() {
4854 setModelClass(AnnouncementsEntry.class);
4855 }
4856
4857
4862 @Override
4863 public void cacheResult(AnnouncementsEntry announcementsEntry) {
4864 entityCache.putResult(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
4865 AnnouncementsEntryImpl.class, announcementsEntry.getPrimaryKey(),
4866 announcementsEntry);
4867
4868 announcementsEntry.resetOriginalValues();
4869 }
4870
4871
4876 @Override
4877 public void cacheResult(List<AnnouncementsEntry> announcementsEntries) {
4878 for (AnnouncementsEntry announcementsEntry : announcementsEntries) {
4879 if (entityCache.getResult(
4880 AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
4881 AnnouncementsEntryImpl.class,
4882 announcementsEntry.getPrimaryKey()) == null) {
4883 cacheResult(announcementsEntry);
4884 }
4885 else {
4886 announcementsEntry.resetOriginalValues();
4887 }
4888 }
4889 }
4890
4891
4898 @Override
4899 public void clearCache() {
4900 entityCache.clearCache(AnnouncementsEntryImpl.class);
4901
4902 finderCache.clearCache(FINDER_CLASS_NAME_ENTITY);
4903 finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
4904 finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
4905 }
4906
4907
4914 @Override
4915 public void clearCache(AnnouncementsEntry announcementsEntry) {
4916 entityCache.removeResult(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
4917 AnnouncementsEntryImpl.class, announcementsEntry.getPrimaryKey());
4918
4919 finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
4920 finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
4921 }
4922
4923 @Override
4924 public void clearCache(List<AnnouncementsEntry> announcementsEntries) {
4925 finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
4926 finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
4927
4928 for (AnnouncementsEntry announcementsEntry : announcementsEntries) {
4929 entityCache.removeResult(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
4930 AnnouncementsEntryImpl.class, announcementsEntry.getPrimaryKey());
4931 }
4932 }
4933
4934
4940 @Override
4941 public AnnouncementsEntry create(long entryId) {
4942 AnnouncementsEntry announcementsEntry = new AnnouncementsEntryImpl();
4943
4944 announcementsEntry.setNew(true);
4945 announcementsEntry.setPrimaryKey(entryId);
4946
4947 String uuid = PortalUUIDUtil.generate();
4948
4949 announcementsEntry.setUuid(uuid);
4950
4951 return announcementsEntry;
4952 }
4953
4954
4961 @Override
4962 public AnnouncementsEntry remove(long entryId) throws NoSuchEntryException {
4963 return remove((Serializable)entryId);
4964 }
4965
4966
4973 @Override
4974 public AnnouncementsEntry remove(Serializable primaryKey)
4975 throws NoSuchEntryException {
4976 Session session = null;
4977
4978 try {
4979 session = openSession();
4980
4981 AnnouncementsEntry announcementsEntry = (AnnouncementsEntry)session.get(AnnouncementsEntryImpl.class,
4982 primaryKey);
4983
4984 if (announcementsEntry == null) {
4985 if (_log.isWarnEnabled()) {
4986 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
4987 }
4988
4989 throw new NoSuchEntryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
4990 primaryKey);
4991 }
4992
4993 return remove(announcementsEntry);
4994 }
4995 catch (NoSuchEntryException nsee) {
4996 throw nsee;
4997 }
4998 catch (Exception e) {
4999 throw processException(e);
5000 }
5001 finally {
5002 closeSession(session);
5003 }
5004 }
5005
5006 @Override
5007 protected AnnouncementsEntry removeImpl(
5008 AnnouncementsEntry announcementsEntry) {
5009 announcementsEntry = toUnwrappedModel(announcementsEntry);
5010
5011 Session session = null;
5012
5013 try {
5014 session = openSession();
5015
5016 if (!session.contains(announcementsEntry)) {
5017 announcementsEntry = (AnnouncementsEntry)session.get(AnnouncementsEntryImpl.class,
5018 announcementsEntry.getPrimaryKeyObj());
5019 }
5020
5021 if (announcementsEntry != null) {
5022 session.delete(announcementsEntry);
5023 }
5024 }
5025 catch (Exception e) {
5026 throw processException(e);
5027 }
5028 finally {
5029 closeSession(session);
5030 }
5031
5032 if (announcementsEntry != null) {
5033 clearCache(announcementsEntry);
5034 }
5035
5036 return announcementsEntry;
5037 }
5038
5039 @Override
5040 public AnnouncementsEntry updateImpl(AnnouncementsEntry announcementsEntry) {
5041 announcementsEntry = toUnwrappedModel(announcementsEntry);
5042
5043 boolean isNew = announcementsEntry.isNew();
5044
5045 AnnouncementsEntryModelImpl announcementsEntryModelImpl = (AnnouncementsEntryModelImpl)announcementsEntry;
5046
5047 if (Validator.isNull(announcementsEntry.getUuid())) {
5048 String uuid = PortalUUIDUtil.generate();
5049
5050 announcementsEntry.setUuid(uuid);
5051 }
5052
5053 ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext();
5054
5055 Date now = new Date();
5056
5057 if (isNew && (announcementsEntry.getCreateDate() == null)) {
5058 if (serviceContext == null) {
5059 announcementsEntry.setCreateDate(now);
5060 }
5061 else {
5062 announcementsEntry.setCreateDate(serviceContext.getCreateDate(
5063 now));
5064 }
5065 }
5066
5067 if (!announcementsEntryModelImpl.hasSetModifiedDate()) {
5068 if (serviceContext == null) {
5069 announcementsEntry.setModifiedDate(now);
5070 }
5071 else {
5072 announcementsEntry.setModifiedDate(serviceContext.getModifiedDate(
5073 now));
5074 }
5075 }
5076
5077 long userId = GetterUtil.getLong(PrincipalThreadLocal.getName());
5078
5079 if (userId > 0) {
5080 long companyId = announcementsEntry.getCompanyId();
5081
5082 long groupId = 0;
5083
5084 long entryId = 0;
5085
5086 if (!isNew) {
5087 entryId = announcementsEntry.getPrimaryKey();
5088 }
5089
5090 try {
5091 announcementsEntry.setContent(SanitizerUtil.sanitize(
5092 companyId, groupId, userId,
5093 com.liferay.portlet.announcements.model.AnnouncementsEntry.class.getName(),
5094 entryId, ContentTypes.TEXT_HTML, Sanitizer.MODE_ALL,
5095 announcementsEntry.getContent(), null));
5096 }
5097 catch (SanitizerException se) {
5098 throw new SystemException(se);
5099 }
5100 }
5101
5102 Session session = null;
5103
5104 try {
5105 session = openSession();
5106
5107 if (announcementsEntry.isNew()) {
5108 session.save(announcementsEntry);
5109
5110 announcementsEntry.setNew(false);
5111 }
5112 else {
5113 announcementsEntry = (AnnouncementsEntry)session.merge(announcementsEntry);
5114 }
5115 }
5116 catch (Exception e) {
5117 throw processException(e);
5118 }
5119 finally {
5120 closeSession(session);
5121 }
5122
5123 finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
5124
5125 if (isNew || !AnnouncementsEntryModelImpl.COLUMN_BITMASK_ENABLED) {
5126 finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
5127 }
5128
5129 else {
5130 if ((announcementsEntryModelImpl.getColumnBitmask() &
5131 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID.getColumnBitmask()) != 0) {
5132 Object[] args = new Object[] {
5133 announcementsEntryModelImpl.getOriginalUuid()
5134 };
5135
5136 finderCache.removeResult(FINDER_PATH_COUNT_BY_UUID, args);
5137 finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID,
5138 args);
5139
5140 args = new Object[] { announcementsEntryModelImpl.getUuid() };
5141
5142 finderCache.removeResult(FINDER_PATH_COUNT_BY_UUID, args);
5143 finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID,
5144 args);
5145 }
5146
5147 if ((announcementsEntryModelImpl.getColumnBitmask() &
5148 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID_C.getColumnBitmask()) != 0) {
5149 Object[] args = new Object[] {
5150 announcementsEntryModelImpl.getOriginalUuid(),
5151 announcementsEntryModelImpl.getOriginalCompanyId()
5152 };
5153
5154 finderCache.removeResult(FINDER_PATH_COUNT_BY_UUID_C, args);
5155 finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID_C,
5156 args);
5157
5158 args = new Object[] {
5159 announcementsEntryModelImpl.getUuid(),
5160 announcementsEntryModelImpl.getCompanyId()
5161 };
5162
5163 finderCache.removeResult(FINDER_PATH_COUNT_BY_UUID_C, args);
5164 finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID_C,
5165 args);
5166 }
5167
5168 if ((announcementsEntryModelImpl.getColumnBitmask() &
5169 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID.getColumnBitmask()) != 0) {
5170 Object[] args = new Object[] {
5171 announcementsEntryModelImpl.getOriginalUserId()
5172 };
5173
5174 finderCache.removeResult(FINDER_PATH_COUNT_BY_USERID, args);
5175 finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID,
5176 args);
5177
5178 args = new Object[] { announcementsEntryModelImpl.getUserId() };
5179
5180 finderCache.removeResult(FINDER_PATH_COUNT_BY_USERID, args);
5181 finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID,
5182 args);
5183 }
5184
5185 if ((announcementsEntryModelImpl.getColumnBitmask() &
5186 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C.getColumnBitmask()) != 0) {
5187 Object[] args = new Object[] {
5188 announcementsEntryModelImpl.getOriginalClassNameId(),
5189 announcementsEntryModelImpl.getOriginalClassPK()
5190 };
5191
5192 finderCache.removeResult(FINDER_PATH_COUNT_BY_C_C, args);
5193 finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C,
5194 args);
5195
5196 args = new Object[] {
5197 announcementsEntryModelImpl.getClassNameId(),
5198 announcementsEntryModelImpl.getClassPK()
5199 };
5200
5201 finderCache.removeResult(FINDER_PATH_COUNT_BY_C_C, args);
5202 finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C,
5203 args);
5204 }
5205
5206 if ((announcementsEntryModelImpl.getColumnBitmask() &
5207 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_A.getColumnBitmask()) != 0) {
5208 Object[] args = new Object[] {
5209 announcementsEntryModelImpl.getOriginalClassNameId(),
5210 announcementsEntryModelImpl.getOriginalClassPK(),
5211 announcementsEntryModelImpl.getOriginalAlert()
5212 };
5213
5214 finderCache.removeResult(FINDER_PATH_COUNT_BY_C_C_A, args);
5215 finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_A,
5216 args);
5217
5218 args = new Object[] {
5219 announcementsEntryModelImpl.getClassNameId(),
5220 announcementsEntryModelImpl.getClassPK(),
5221 announcementsEntryModelImpl.getAlert()
5222 };
5223
5224 finderCache.removeResult(FINDER_PATH_COUNT_BY_C_C_A, args);
5225 finderCache.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_A,
5226 args);
5227 }
5228 }
5229
5230 entityCache.putResult(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
5231 AnnouncementsEntryImpl.class, announcementsEntry.getPrimaryKey(),
5232 announcementsEntry, false);
5233
5234 announcementsEntry.resetOriginalValues();
5235
5236 return announcementsEntry;
5237 }
5238
5239 protected AnnouncementsEntry toUnwrappedModel(
5240 AnnouncementsEntry announcementsEntry) {
5241 if (announcementsEntry instanceof AnnouncementsEntryImpl) {
5242 return announcementsEntry;
5243 }
5244
5245 AnnouncementsEntryImpl announcementsEntryImpl = new AnnouncementsEntryImpl();
5246
5247 announcementsEntryImpl.setNew(announcementsEntry.isNew());
5248 announcementsEntryImpl.setPrimaryKey(announcementsEntry.getPrimaryKey());
5249
5250 announcementsEntryImpl.setUuid(announcementsEntry.getUuid());
5251 announcementsEntryImpl.setEntryId(announcementsEntry.getEntryId());
5252 announcementsEntryImpl.setCompanyId(announcementsEntry.getCompanyId());
5253 announcementsEntryImpl.setUserId(announcementsEntry.getUserId());
5254 announcementsEntryImpl.setUserName(announcementsEntry.getUserName());
5255 announcementsEntryImpl.setCreateDate(announcementsEntry.getCreateDate());
5256 announcementsEntryImpl.setModifiedDate(announcementsEntry.getModifiedDate());
5257 announcementsEntryImpl.setClassNameId(announcementsEntry.getClassNameId());
5258 announcementsEntryImpl.setClassPK(announcementsEntry.getClassPK());
5259 announcementsEntryImpl.setTitle(announcementsEntry.getTitle());
5260 announcementsEntryImpl.setContent(announcementsEntry.getContent());
5261 announcementsEntryImpl.setUrl(announcementsEntry.getUrl());
5262 announcementsEntryImpl.setType(announcementsEntry.getType());
5263 announcementsEntryImpl.setDisplayDate(announcementsEntry.getDisplayDate());
5264 announcementsEntryImpl.setExpirationDate(announcementsEntry.getExpirationDate());
5265 announcementsEntryImpl.setPriority(announcementsEntry.getPriority());
5266 announcementsEntryImpl.setAlert(announcementsEntry.isAlert());
5267
5268 return announcementsEntryImpl;
5269 }
5270
5271
5278 @Override
5279 public AnnouncementsEntry findByPrimaryKey(Serializable primaryKey)
5280 throws NoSuchEntryException {
5281 AnnouncementsEntry announcementsEntry = fetchByPrimaryKey(primaryKey);
5282
5283 if (announcementsEntry == null) {
5284 if (_log.isWarnEnabled()) {
5285 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
5286 }
5287
5288 throw new NoSuchEntryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
5289 primaryKey);
5290 }
5291
5292 return announcementsEntry;
5293 }
5294
5295
5302 @Override
5303 public AnnouncementsEntry findByPrimaryKey(long entryId)
5304 throws NoSuchEntryException {
5305 return findByPrimaryKey((Serializable)entryId);
5306 }
5307
5308
5314 @Override
5315 public AnnouncementsEntry fetchByPrimaryKey(Serializable primaryKey) {
5316 AnnouncementsEntry announcementsEntry = (AnnouncementsEntry)entityCache.getResult(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
5317 AnnouncementsEntryImpl.class, primaryKey);
5318
5319 if (announcementsEntry == _nullAnnouncementsEntry) {
5320 return null;
5321 }
5322
5323 if (announcementsEntry == null) {
5324 Session session = null;
5325
5326 try {
5327 session = openSession();
5328
5329 announcementsEntry = (AnnouncementsEntry)session.get(AnnouncementsEntryImpl.class,
5330 primaryKey);
5331
5332 if (announcementsEntry != null) {
5333 cacheResult(announcementsEntry);
5334 }
5335 else {
5336 entityCache.putResult(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
5337 AnnouncementsEntryImpl.class, primaryKey,
5338 _nullAnnouncementsEntry);
5339 }
5340 }
5341 catch (Exception e) {
5342 entityCache.removeResult(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
5343 AnnouncementsEntryImpl.class, primaryKey);
5344
5345 throw processException(e);
5346 }
5347 finally {
5348 closeSession(session);
5349 }
5350 }
5351
5352 return announcementsEntry;
5353 }
5354
5355
5361 @Override
5362 public AnnouncementsEntry fetchByPrimaryKey(long entryId) {
5363 return fetchByPrimaryKey((Serializable)entryId);
5364 }
5365
5366 @Override
5367 public Map<Serializable, AnnouncementsEntry> fetchByPrimaryKeys(
5368 Set<Serializable> primaryKeys) {
5369 if (primaryKeys.isEmpty()) {
5370 return Collections.emptyMap();
5371 }
5372
5373 Map<Serializable, AnnouncementsEntry> map = new HashMap<Serializable, AnnouncementsEntry>();
5374
5375 if (primaryKeys.size() == 1) {
5376 Iterator<Serializable> iterator = primaryKeys.iterator();
5377
5378 Serializable primaryKey = iterator.next();
5379
5380 AnnouncementsEntry announcementsEntry = fetchByPrimaryKey(primaryKey);
5381
5382 if (announcementsEntry != null) {
5383 map.put(primaryKey, announcementsEntry);
5384 }
5385
5386 return map;
5387 }
5388
5389 Set<Serializable> uncachedPrimaryKeys = null;
5390
5391 for (Serializable primaryKey : primaryKeys) {
5392 AnnouncementsEntry announcementsEntry = (AnnouncementsEntry)entityCache.getResult(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
5393 AnnouncementsEntryImpl.class, primaryKey);
5394
5395 if (announcementsEntry == null) {
5396 if (uncachedPrimaryKeys == null) {
5397 uncachedPrimaryKeys = new HashSet<Serializable>();
5398 }
5399
5400 uncachedPrimaryKeys.add(primaryKey);
5401 }
5402 else {
5403 map.put(primaryKey, announcementsEntry);
5404 }
5405 }
5406
5407 if (uncachedPrimaryKeys == null) {
5408 return map;
5409 }
5410
5411 StringBundler query = new StringBundler((uncachedPrimaryKeys.size() * 2) +
5412 1);
5413
5414 query.append(_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE_PKS_IN);
5415
5416 for (Serializable primaryKey : uncachedPrimaryKeys) {
5417 query.append(String.valueOf(primaryKey));
5418
5419 query.append(StringPool.COMMA);
5420 }
5421
5422 query.setIndex(query.index() - 1);
5423
5424 query.append(StringPool.CLOSE_PARENTHESIS);
5425
5426 String sql = query.toString();
5427
5428 Session session = null;
5429
5430 try {
5431 session = openSession();
5432
5433 Query q = session.createQuery(sql);
5434
5435 for (AnnouncementsEntry announcementsEntry : (List<AnnouncementsEntry>)q.list()) {
5436 map.put(announcementsEntry.getPrimaryKeyObj(),
5437 announcementsEntry);
5438
5439 cacheResult(announcementsEntry);
5440
5441 uncachedPrimaryKeys.remove(announcementsEntry.getPrimaryKeyObj());
5442 }
5443
5444 for (Serializable primaryKey : uncachedPrimaryKeys) {
5445 entityCache.putResult(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
5446 AnnouncementsEntryImpl.class, primaryKey,
5447 _nullAnnouncementsEntry);
5448 }
5449 }
5450 catch (Exception e) {
5451 throw processException(e);
5452 }
5453 finally {
5454 closeSession(session);
5455 }
5456
5457 return map;
5458 }
5459
5460
5465 @Override
5466 public List<AnnouncementsEntry> findAll() {
5467 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
5468 }
5469
5470
5481 @Override
5482 public List<AnnouncementsEntry> findAll(int start, int end) {
5483 return findAll(start, end, null);
5484 }
5485
5486
5498 @Override
5499 public List<AnnouncementsEntry> findAll(int start, int end,
5500 OrderByComparator<AnnouncementsEntry> orderByComparator) {
5501 return findAll(start, end, orderByComparator, true);
5502 }
5503
5504
5517 @Override
5518 public List<AnnouncementsEntry> findAll(int start, int end,
5519 OrderByComparator<AnnouncementsEntry> orderByComparator,
5520 boolean retrieveFromCache) {
5521 boolean pagination = true;
5522 FinderPath finderPath = null;
5523 Object[] finderArgs = null;
5524
5525 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
5526 (orderByComparator == null)) {
5527 pagination = false;
5528 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
5529 finderArgs = FINDER_ARGS_EMPTY;
5530 }
5531 else {
5532 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
5533 finderArgs = new Object[] { start, end, orderByComparator };
5534 }
5535
5536 List<AnnouncementsEntry> list = null;
5537
5538 if (retrieveFromCache) {
5539 list = (List<AnnouncementsEntry>)finderCache.getResult(finderPath,
5540 finderArgs, this);
5541 }
5542
5543 if (list == null) {
5544 StringBundler query = null;
5545 String sql = null;
5546
5547 if (orderByComparator != null) {
5548 query = new StringBundler(2 +
5549 (orderByComparator.getOrderByFields().length * 3));
5550
5551 query.append(_SQL_SELECT_ANNOUNCEMENTSENTRY);
5552
5553 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
5554 orderByComparator);
5555
5556 sql = query.toString();
5557 }
5558 else {
5559 sql = _SQL_SELECT_ANNOUNCEMENTSENTRY;
5560
5561 if (pagination) {
5562 sql = sql.concat(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
5563 }
5564 }
5565
5566 Session session = null;
5567
5568 try {
5569 session = openSession();
5570
5571 Query q = session.createQuery(sql);
5572
5573 if (!pagination) {
5574 list = (List<AnnouncementsEntry>)QueryUtil.list(q,
5575 getDialect(), start, end, false);
5576
5577 Collections.sort(list);
5578
5579 list = Collections.unmodifiableList(list);
5580 }
5581 else {
5582 list = (List<AnnouncementsEntry>)QueryUtil.list(q,
5583 getDialect(), start, end);
5584 }
5585
5586 cacheResult(list);
5587
5588 finderCache.putResult(finderPath, finderArgs, list);
5589 }
5590 catch (Exception e) {
5591 finderCache.removeResult(finderPath, finderArgs);
5592
5593 throw processException(e);
5594 }
5595 finally {
5596 closeSession(session);
5597 }
5598 }
5599
5600 return list;
5601 }
5602
5603
5607 @Override
5608 public void removeAll() {
5609 for (AnnouncementsEntry announcementsEntry : findAll()) {
5610 remove(announcementsEntry);
5611 }
5612 }
5613
5614
5619 @Override
5620 public int countAll() {
5621 Long count = (Long)finderCache.getResult(FINDER_PATH_COUNT_ALL,
5622 FINDER_ARGS_EMPTY, this);
5623
5624 if (count == null) {
5625 Session session = null;
5626
5627 try {
5628 session = openSession();
5629
5630 Query q = session.createQuery(_SQL_COUNT_ANNOUNCEMENTSENTRY);
5631
5632 count = (Long)q.uniqueResult();
5633
5634 finderCache.putResult(FINDER_PATH_COUNT_ALL, FINDER_ARGS_EMPTY,
5635 count);
5636 }
5637 catch (Exception e) {
5638 finderCache.removeResult(FINDER_PATH_COUNT_ALL,
5639 FINDER_ARGS_EMPTY);
5640
5641 throw processException(e);
5642 }
5643 finally {
5644 closeSession(session);
5645 }
5646 }
5647
5648 return count.intValue();
5649 }
5650
5651 @Override
5652 public Set<String> getBadColumnNames() {
5653 return _badColumnNames;
5654 }
5655
5656 @Override
5657 protected Map<String, Integer> getTableColumnsMap() {
5658 return AnnouncementsEntryModelImpl.TABLE_COLUMNS_MAP;
5659 }
5660
5661
5664 public void afterPropertiesSet() {
5665 }
5666
5667 public void destroy() {
5668 entityCache.removeCache(AnnouncementsEntryImpl.class.getName());
5669 finderCache.removeCache(FINDER_CLASS_NAME_ENTITY);
5670 finderCache.removeCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
5671 finderCache.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
5672 }
5673
5674 protected EntityCache entityCache = EntityCacheUtil.getEntityCache();
5675 protected FinderCache finderCache = FinderCacheUtil.getFinderCache();
5676 private static final String _SQL_SELECT_ANNOUNCEMENTSENTRY = "SELECT announcementsEntry FROM AnnouncementsEntry announcementsEntry";
5677 private static final String _SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE_PKS_IN = "SELECT announcementsEntry FROM AnnouncementsEntry announcementsEntry WHERE entryId IN (";
5678 private static final String _SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE = "SELECT announcementsEntry FROM AnnouncementsEntry announcementsEntry WHERE ";
5679 private static final String _SQL_COUNT_ANNOUNCEMENTSENTRY = "SELECT COUNT(announcementsEntry) FROM AnnouncementsEntry announcementsEntry";
5680 private static final String _SQL_COUNT_ANNOUNCEMENTSENTRY_WHERE = "SELECT COUNT(announcementsEntry) FROM AnnouncementsEntry announcementsEntry WHERE ";
5681 private static final String _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN = "announcementsEntry.entryId";
5682 private static final String _FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE = "SELECT DISTINCT {announcementsEntry.*} FROM AnnouncementsEntry announcementsEntry WHERE ";
5683 private static final String _FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_1 =
5684 "SELECT {AnnouncementsEntry.*} FROM (SELECT DISTINCT announcementsEntry.entryId FROM AnnouncementsEntry announcementsEntry WHERE ";
5685 private static final String _FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_2 =
5686 ") TEMP_TABLE INNER JOIN AnnouncementsEntry ON TEMP_TABLE.entryId = AnnouncementsEntry.entryId";
5687 private static final String _FILTER_SQL_COUNT_ANNOUNCEMENTSENTRY_WHERE = "SELECT COUNT(DISTINCT announcementsEntry.entryId) AS COUNT_VALUE FROM AnnouncementsEntry announcementsEntry WHERE ";
5688 private static final String _FILTER_ENTITY_ALIAS = "announcementsEntry";
5689 private static final String _FILTER_ENTITY_TABLE = "AnnouncementsEntry";
5690 private static final String _ORDER_BY_ENTITY_ALIAS = "announcementsEntry.";
5691 private static final String _ORDER_BY_ENTITY_TABLE = "AnnouncementsEntry.";
5692 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No AnnouncementsEntry exists with the primary key ";
5693 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No AnnouncementsEntry exists with the key {";
5694 private static final Log _log = LogFactoryUtil.getLog(AnnouncementsEntryPersistenceImpl.class);
5695 private static final Set<String> _badColumnNames = SetUtil.fromArray(new String[] {
5696 "uuid", "type"
5697 });
5698 private static final AnnouncementsEntry _nullAnnouncementsEntry = new AnnouncementsEntryImpl() {
5699 @Override
5700 public Object clone() {
5701 return this;
5702 }
5703
5704 @Override
5705 public CacheModel<AnnouncementsEntry> toCacheModel() {
5706 return _nullAnnouncementsEntryCacheModel;
5707 }
5708 };
5709
5710 private static final CacheModel<AnnouncementsEntry> _nullAnnouncementsEntryCacheModel =
5711 new CacheModel<AnnouncementsEntry>() {
5712 @Override
5713 public AnnouncementsEntry toEntityModel() {
5714 return _nullAnnouncementsEntry;
5715 }
5716 };
5717 }