001
014
015 package com.liferay.portlet.announcements.service.persistence;
016
017 import com.liferay.portal.NoSuchModelException;
018 import com.liferay.portal.kernel.bean.BeanReference;
019 import com.liferay.portal.kernel.cache.CacheRegistryUtil;
020 import com.liferay.portal.kernel.dao.orm.EntityCacheUtil;
021 import com.liferay.portal.kernel.dao.orm.FinderCacheUtil;
022 import com.liferay.portal.kernel.dao.orm.FinderPath;
023 import com.liferay.portal.kernel.dao.orm.Query;
024 import com.liferay.portal.kernel.dao.orm.QueryPos;
025 import com.liferay.portal.kernel.dao.orm.QueryUtil;
026 import com.liferay.portal.kernel.dao.orm.SQLQuery;
027 import com.liferay.portal.kernel.dao.orm.Session;
028 import com.liferay.portal.kernel.exception.SystemException;
029 import com.liferay.portal.kernel.log.Log;
030 import com.liferay.portal.kernel.log.LogFactoryUtil;
031 import com.liferay.portal.kernel.util.GetterUtil;
032 import com.liferay.portal.kernel.util.InstanceFactory;
033 import com.liferay.portal.kernel.util.OrderByComparator;
034 import com.liferay.portal.kernel.util.StringBundler;
035 import com.liferay.portal.kernel.util.StringPool;
036 import com.liferay.portal.kernel.util.StringUtil;
037 import com.liferay.portal.kernel.util.Validator;
038 import com.liferay.portal.kernel.uuid.PortalUUIDUtil;
039 import com.liferay.portal.model.CacheModel;
040 import com.liferay.portal.model.ModelListener;
041 import com.liferay.portal.security.permission.InlineSQLHelperUtil;
042 import com.liferay.portal.service.persistence.BatchSessionUtil;
043 import com.liferay.portal.service.persistence.CompanyPersistence;
044 import com.liferay.portal.service.persistence.GroupPersistence;
045 import com.liferay.portal.service.persistence.OrganizationPersistence;
046 import com.liferay.portal.service.persistence.ResourcePersistence;
047 import com.liferay.portal.service.persistence.RolePersistence;
048 import com.liferay.portal.service.persistence.UserGroupPersistence;
049 import com.liferay.portal.service.persistence.UserPersistence;
050 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
051
052 import com.liferay.portlet.announcements.NoSuchEntryException;
053 import com.liferay.portlet.announcements.model.AnnouncementsEntry;
054 import com.liferay.portlet.announcements.model.impl.AnnouncementsEntryImpl;
055 import com.liferay.portlet.announcements.model.impl.AnnouncementsEntryModelImpl;
056
057 import java.io.Serializable;
058
059 import java.util.ArrayList;
060 import java.util.Collections;
061 import java.util.List;
062
063
075 public class AnnouncementsEntryPersistenceImpl extends BasePersistenceImpl<AnnouncementsEntry>
076 implements AnnouncementsEntryPersistence {
077
082 public static final String FINDER_CLASS_NAME_ENTITY = AnnouncementsEntryImpl.class.getName();
083 public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY +
084 ".List1";
085 public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY +
086 ".List2";
087 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_UUID = new FinderPath(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
088 AnnouncementsEntryModelImpl.FINDER_CACHE_ENABLED,
089 AnnouncementsEntryImpl.class,
090 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByUuid",
091 new String[] {
092 String.class.getName(),
093
094 "java.lang.Integer", "java.lang.Integer",
095 "com.liferay.portal.kernel.util.OrderByComparator"
096 });
097 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID = new FinderPath(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
098 AnnouncementsEntryModelImpl.FINDER_CACHE_ENABLED,
099 AnnouncementsEntryImpl.class,
100 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByUuid",
101 new String[] { String.class.getName() },
102 AnnouncementsEntryModelImpl.UUID_COLUMN_BITMASK);
103 public static final FinderPath FINDER_PATH_COUNT_BY_UUID = new FinderPath(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
104 AnnouncementsEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
105 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUuid",
106 new String[] { String.class.getName() });
107 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_USERID = new FinderPath(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
108 AnnouncementsEntryModelImpl.FINDER_CACHE_ENABLED,
109 AnnouncementsEntryImpl.class,
110 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByUserId",
111 new String[] {
112 Long.class.getName(),
113
114 "java.lang.Integer", "java.lang.Integer",
115 "com.liferay.portal.kernel.util.OrderByComparator"
116 });
117 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID =
118 new FinderPath(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
119 AnnouncementsEntryModelImpl.FINDER_CACHE_ENABLED,
120 AnnouncementsEntryImpl.class,
121 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByUserId",
122 new String[] { Long.class.getName() },
123 AnnouncementsEntryModelImpl.USERID_COLUMN_BITMASK);
124 public static final FinderPath FINDER_PATH_COUNT_BY_USERID = new FinderPath(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
125 AnnouncementsEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
126 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUserId",
127 new String[] { Long.class.getName() });
128 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_C_C = new FinderPath(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
129 AnnouncementsEntryModelImpl.FINDER_CACHE_ENABLED,
130 AnnouncementsEntryImpl.class,
131 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByC_C",
132 new String[] {
133 Long.class.getName(), Long.class.getName(),
134
135 "java.lang.Integer", "java.lang.Integer",
136 "com.liferay.portal.kernel.util.OrderByComparator"
137 });
138 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C = new FinderPath(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
139 AnnouncementsEntryModelImpl.FINDER_CACHE_ENABLED,
140 AnnouncementsEntryImpl.class,
141 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByC_C",
142 new String[] { Long.class.getName(), Long.class.getName() },
143 AnnouncementsEntryModelImpl.CLASSNAMEID_COLUMN_BITMASK |
144 AnnouncementsEntryModelImpl.CLASSPK_COLUMN_BITMASK);
145 public static final FinderPath FINDER_PATH_COUNT_BY_C_C = new FinderPath(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
146 AnnouncementsEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
147 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_C",
148 new String[] { Long.class.getName(), Long.class.getName() });
149 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_BY_C_C_A = new FinderPath(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
150 AnnouncementsEntryModelImpl.FINDER_CACHE_ENABLED,
151 AnnouncementsEntryImpl.class,
152 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByC_C_A",
153 new String[] {
154 Long.class.getName(), Long.class.getName(),
155 Boolean.class.getName(),
156
157 "java.lang.Integer", "java.lang.Integer",
158 "com.liferay.portal.kernel.util.OrderByComparator"
159 });
160 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_A = new FinderPath(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
161 AnnouncementsEntryModelImpl.FINDER_CACHE_ENABLED,
162 AnnouncementsEntryImpl.class,
163 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByC_C_A",
164 new String[] {
165 Long.class.getName(), Long.class.getName(),
166 Boolean.class.getName()
167 },
168 AnnouncementsEntryModelImpl.CLASSNAMEID_COLUMN_BITMASK |
169 AnnouncementsEntryModelImpl.CLASSPK_COLUMN_BITMASK |
170 AnnouncementsEntryModelImpl.ALERT_COLUMN_BITMASK);
171 public static final FinderPath FINDER_PATH_COUNT_BY_C_C_A = new FinderPath(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
172 AnnouncementsEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
173 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_C_A",
174 new String[] {
175 Long.class.getName(), Long.class.getName(),
176 Boolean.class.getName()
177 });
178 public static final FinderPath FINDER_PATH_WITH_PAGINATION_FIND_ALL = new FinderPath(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
179 AnnouncementsEntryModelImpl.FINDER_CACHE_ENABLED,
180 AnnouncementsEntryImpl.class,
181 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]);
182 public static final FinderPath FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL = new FinderPath(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
183 AnnouncementsEntryModelImpl.FINDER_CACHE_ENABLED,
184 AnnouncementsEntryImpl.class,
185 FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]);
186 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
187 AnnouncementsEntryModelImpl.FINDER_CACHE_ENABLED, Long.class,
188 FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]);
189
190
195 public void cacheResult(AnnouncementsEntry announcementsEntry) {
196 EntityCacheUtil.putResult(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
197 AnnouncementsEntryImpl.class, announcementsEntry.getPrimaryKey(),
198 announcementsEntry);
199
200 announcementsEntry.resetOriginalValues();
201 }
202
203
208 public void cacheResult(List<AnnouncementsEntry> announcementsEntries) {
209 for (AnnouncementsEntry announcementsEntry : announcementsEntries) {
210 if (EntityCacheUtil.getResult(
211 AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
212 AnnouncementsEntryImpl.class,
213 announcementsEntry.getPrimaryKey()) == null) {
214 cacheResult(announcementsEntry);
215 }
216 else {
217 announcementsEntry.resetOriginalValues();
218 }
219 }
220 }
221
222
229 @Override
230 public void clearCache() {
231 if (_HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE) {
232 CacheRegistryUtil.clear(AnnouncementsEntryImpl.class.getName());
233 }
234
235 EntityCacheUtil.clearCache(AnnouncementsEntryImpl.class.getName());
236
237 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
238 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
239 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
240 }
241
242
249 @Override
250 public void clearCache(AnnouncementsEntry announcementsEntry) {
251 EntityCacheUtil.removeResult(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
252 AnnouncementsEntryImpl.class, announcementsEntry.getPrimaryKey());
253
254 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
255 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
256 }
257
258 @Override
259 public void clearCache(List<AnnouncementsEntry> announcementsEntries) {
260 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
261 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
262
263 for (AnnouncementsEntry announcementsEntry : announcementsEntries) {
264 EntityCacheUtil.removeResult(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
265 AnnouncementsEntryImpl.class, announcementsEntry.getPrimaryKey());
266 }
267 }
268
269
275 public AnnouncementsEntry create(long entryId) {
276 AnnouncementsEntry announcementsEntry = new AnnouncementsEntryImpl();
277
278 announcementsEntry.setNew(true);
279 announcementsEntry.setPrimaryKey(entryId);
280
281 String uuid = PortalUUIDUtil.generate();
282
283 announcementsEntry.setUuid(uuid);
284
285 return announcementsEntry;
286 }
287
288
296 public AnnouncementsEntry remove(long entryId)
297 throws NoSuchEntryException, SystemException {
298 return remove(Long.valueOf(entryId));
299 }
300
301
309 @Override
310 public AnnouncementsEntry remove(Serializable primaryKey)
311 throws NoSuchEntryException, SystemException {
312 Session session = null;
313
314 try {
315 session = openSession();
316
317 AnnouncementsEntry announcementsEntry = (AnnouncementsEntry)session.get(AnnouncementsEntryImpl.class,
318 primaryKey);
319
320 if (announcementsEntry == null) {
321 if (_log.isWarnEnabled()) {
322 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
323 }
324
325 throw new NoSuchEntryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
326 primaryKey);
327 }
328
329 return remove(announcementsEntry);
330 }
331 catch (NoSuchEntryException nsee) {
332 throw nsee;
333 }
334 catch (Exception e) {
335 throw processException(e);
336 }
337 finally {
338 closeSession(session);
339 }
340 }
341
342 @Override
343 protected AnnouncementsEntry removeImpl(
344 AnnouncementsEntry announcementsEntry) throws SystemException {
345 announcementsEntry = toUnwrappedModel(announcementsEntry);
346
347 Session session = null;
348
349 try {
350 session = openSession();
351
352 BatchSessionUtil.delete(session, announcementsEntry);
353 }
354 catch (Exception e) {
355 throw processException(e);
356 }
357 finally {
358 closeSession(session);
359 }
360
361 clearCache(announcementsEntry);
362
363 return announcementsEntry;
364 }
365
366 @Override
367 public AnnouncementsEntry updateImpl(
368 com.liferay.portlet.announcements.model.AnnouncementsEntry announcementsEntry,
369 boolean merge) throws SystemException {
370 announcementsEntry = toUnwrappedModel(announcementsEntry);
371
372 boolean isNew = announcementsEntry.isNew();
373
374 AnnouncementsEntryModelImpl announcementsEntryModelImpl = (AnnouncementsEntryModelImpl)announcementsEntry;
375
376 if (Validator.isNull(announcementsEntry.getUuid())) {
377 String uuid = PortalUUIDUtil.generate();
378
379 announcementsEntry.setUuid(uuid);
380 }
381
382 Session session = null;
383
384 try {
385 session = openSession();
386
387 BatchSessionUtil.update(session, announcementsEntry, merge);
388
389 announcementsEntry.setNew(false);
390 }
391 catch (Exception e) {
392 throw processException(e);
393 }
394 finally {
395 closeSession(session);
396 }
397
398 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION);
399
400 if (isNew || !AnnouncementsEntryModelImpl.COLUMN_BITMASK_ENABLED) {
401 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
402 }
403
404 else {
405 if ((announcementsEntryModelImpl.getColumnBitmask() &
406 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID.getColumnBitmask()) != 0) {
407 Object[] args = new Object[] {
408 announcementsEntryModelImpl.getOriginalUuid()
409 };
410
411 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID, args);
412 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID,
413 args);
414
415 args = new Object[] { announcementsEntryModelImpl.getUuid() };
416
417 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID, args);
418 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID,
419 args);
420 }
421
422 if ((announcementsEntryModelImpl.getColumnBitmask() &
423 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID.getColumnBitmask()) != 0) {
424 Object[] args = new Object[] {
425 Long.valueOf(announcementsEntryModelImpl.getOriginalUserId())
426 };
427
428 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERID, args);
429 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID,
430 args);
431
432 args = new Object[] {
433 Long.valueOf(announcementsEntryModelImpl.getUserId())
434 };
435
436 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERID, args);
437 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID,
438 args);
439 }
440
441 if ((announcementsEntryModelImpl.getColumnBitmask() &
442 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C.getColumnBitmask()) != 0) {
443 Object[] args = new Object[] {
444 Long.valueOf(announcementsEntryModelImpl.getOriginalClassNameId()),
445 Long.valueOf(announcementsEntryModelImpl.getOriginalClassPK())
446 };
447
448 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_C, args);
449 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C,
450 args);
451
452 args = new Object[] {
453 Long.valueOf(announcementsEntryModelImpl.getClassNameId()),
454 Long.valueOf(announcementsEntryModelImpl.getClassPK())
455 };
456
457 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_C, args);
458 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C,
459 args);
460 }
461
462 if ((announcementsEntryModelImpl.getColumnBitmask() &
463 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_A.getColumnBitmask()) != 0) {
464 Object[] args = new Object[] {
465 Long.valueOf(announcementsEntryModelImpl.getOriginalClassNameId()),
466 Long.valueOf(announcementsEntryModelImpl.getOriginalClassPK()),
467 Boolean.valueOf(announcementsEntryModelImpl.getOriginalAlert())
468 };
469
470 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_C_A, args);
471 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_A,
472 args);
473
474 args = new Object[] {
475 Long.valueOf(announcementsEntryModelImpl.getClassNameId()),
476 Long.valueOf(announcementsEntryModelImpl.getClassPK()),
477 Boolean.valueOf(announcementsEntryModelImpl.getAlert())
478 };
479
480 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_C_A, args);
481 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_A,
482 args);
483 }
484 }
485
486 EntityCacheUtil.putResult(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
487 AnnouncementsEntryImpl.class, announcementsEntry.getPrimaryKey(),
488 announcementsEntry);
489
490 return announcementsEntry;
491 }
492
493 protected AnnouncementsEntry toUnwrappedModel(
494 AnnouncementsEntry announcementsEntry) {
495 if (announcementsEntry instanceof AnnouncementsEntryImpl) {
496 return announcementsEntry;
497 }
498
499 AnnouncementsEntryImpl announcementsEntryImpl = new AnnouncementsEntryImpl();
500
501 announcementsEntryImpl.setNew(announcementsEntry.isNew());
502 announcementsEntryImpl.setPrimaryKey(announcementsEntry.getPrimaryKey());
503
504 announcementsEntryImpl.setUuid(announcementsEntry.getUuid());
505 announcementsEntryImpl.setEntryId(announcementsEntry.getEntryId());
506 announcementsEntryImpl.setCompanyId(announcementsEntry.getCompanyId());
507 announcementsEntryImpl.setUserId(announcementsEntry.getUserId());
508 announcementsEntryImpl.setUserName(announcementsEntry.getUserName());
509 announcementsEntryImpl.setCreateDate(announcementsEntry.getCreateDate());
510 announcementsEntryImpl.setModifiedDate(announcementsEntry.getModifiedDate());
511 announcementsEntryImpl.setClassNameId(announcementsEntry.getClassNameId());
512 announcementsEntryImpl.setClassPK(announcementsEntry.getClassPK());
513 announcementsEntryImpl.setTitle(announcementsEntry.getTitle());
514 announcementsEntryImpl.setContent(announcementsEntry.getContent());
515 announcementsEntryImpl.setUrl(announcementsEntry.getUrl());
516 announcementsEntryImpl.setType(announcementsEntry.getType());
517 announcementsEntryImpl.setDisplayDate(announcementsEntry.getDisplayDate());
518 announcementsEntryImpl.setExpirationDate(announcementsEntry.getExpirationDate());
519 announcementsEntryImpl.setPriority(announcementsEntry.getPriority());
520 announcementsEntryImpl.setAlert(announcementsEntry.isAlert());
521
522 return announcementsEntryImpl;
523 }
524
525
533 @Override
534 public AnnouncementsEntry findByPrimaryKey(Serializable primaryKey)
535 throws NoSuchModelException, SystemException {
536 return findByPrimaryKey(((Long)primaryKey).longValue());
537 }
538
539
547 public AnnouncementsEntry findByPrimaryKey(long entryId)
548 throws NoSuchEntryException, SystemException {
549 AnnouncementsEntry announcementsEntry = fetchByPrimaryKey(entryId);
550
551 if (announcementsEntry == null) {
552 if (_log.isWarnEnabled()) {
553 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + entryId);
554 }
555
556 throw new NoSuchEntryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
557 entryId);
558 }
559
560 return announcementsEntry;
561 }
562
563
570 @Override
571 public AnnouncementsEntry fetchByPrimaryKey(Serializable primaryKey)
572 throws SystemException {
573 return fetchByPrimaryKey(((Long)primaryKey).longValue());
574 }
575
576
583 public AnnouncementsEntry fetchByPrimaryKey(long entryId)
584 throws SystemException {
585 AnnouncementsEntry announcementsEntry = (AnnouncementsEntry)EntityCacheUtil.getResult(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
586 AnnouncementsEntryImpl.class, entryId);
587
588 if (announcementsEntry == _nullAnnouncementsEntry) {
589 return null;
590 }
591
592 if (announcementsEntry == null) {
593 Session session = null;
594
595 boolean hasException = false;
596
597 try {
598 session = openSession();
599
600 announcementsEntry = (AnnouncementsEntry)session.get(AnnouncementsEntryImpl.class,
601 Long.valueOf(entryId));
602 }
603 catch (Exception e) {
604 hasException = true;
605
606 throw processException(e);
607 }
608 finally {
609 if (announcementsEntry != null) {
610 cacheResult(announcementsEntry);
611 }
612 else if (!hasException) {
613 EntityCacheUtil.putResult(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
614 AnnouncementsEntryImpl.class, entryId,
615 _nullAnnouncementsEntry);
616 }
617
618 closeSession(session);
619 }
620 }
621
622 return announcementsEntry;
623 }
624
625
632 public List<AnnouncementsEntry> findByUuid(String uuid)
633 throws SystemException {
634 return findByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
635 }
636
637
650 public List<AnnouncementsEntry> findByUuid(String uuid, int start, int end)
651 throws SystemException {
652 return findByUuid(uuid, start, end, null);
653 }
654
655
669 public List<AnnouncementsEntry> findByUuid(String uuid, int start, int end,
670 OrderByComparator orderByComparator) throws SystemException {
671 FinderPath finderPath = null;
672 Object[] finderArgs = null;
673
674 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
675 (orderByComparator == null)) {
676 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID;
677 finderArgs = new Object[] { uuid };
678 }
679 else {
680 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_UUID;
681 finderArgs = new Object[] { uuid, start, end, orderByComparator };
682 }
683
684 List<AnnouncementsEntry> list = (List<AnnouncementsEntry>)FinderCacheUtil.getResult(finderPath,
685 finderArgs, this);
686
687 if (list == null) {
688 StringBundler query = null;
689
690 if (orderByComparator != null) {
691 query = new StringBundler(3 +
692 (orderByComparator.getOrderByFields().length * 3));
693 }
694 else {
695 query = new StringBundler(3);
696 }
697
698 query.append(_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
699
700 if (uuid == null) {
701 query.append(_FINDER_COLUMN_UUID_UUID_1);
702 }
703 else {
704 if (uuid.equals(StringPool.BLANK)) {
705 query.append(_FINDER_COLUMN_UUID_UUID_3);
706 }
707 else {
708 query.append(_FINDER_COLUMN_UUID_UUID_2);
709 }
710 }
711
712 if (orderByComparator != null) {
713 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
714 orderByComparator);
715 }
716
717 else {
718 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
719 }
720
721 String sql = query.toString();
722
723 Session session = null;
724
725 try {
726 session = openSession();
727
728 Query q = session.createQuery(sql);
729
730 QueryPos qPos = QueryPos.getInstance(q);
731
732 if (uuid != null) {
733 qPos.add(uuid);
734 }
735
736 list = (List<AnnouncementsEntry>)QueryUtil.list(q,
737 getDialect(), start, end);
738 }
739 catch (Exception e) {
740 throw processException(e);
741 }
742 finally {
743 if (list == null) {
744 FinderCacheUtil.removeResult(finderPath, finderArgs);
745 }
746 else {
747 cacheResult(list);
748
749 FinderCacheUtil.putResult(finderPath, finderArgs, list);
750 }
751
752 closeSession(session);
753 }
754 }
755
756 return list;
757 }
758
759
772 public AnnouncementsEntry findByUuid_First(String uuid,
773 OrderByComparator orderByComparator)
774 throws NoSuchEntryException, SystemException {
775 List<AnnouncementsEntry> list = findByUuid(uuid, 0, 1, orderByComparator);
776
777 if (list.isEmpty()) {
778 StringBundler msg = new StringBundler(4);
779
780 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
781
782 msg.append("uuid=");
783 msg.append(uuid);
784
785 msg.append(StringPool.CLOSE_CURLY_BRACE);
786
787 throw new NoSuchEntryException(msg.toString());
788 }
789 else {
790 return list.get(0);
791 }
792 }
793
794
807 public AnnouncementsEntry findByUuid_Last(String uuid,
808 OrderByComparator orderByComparator)
809 throws NoSuchEntryException, SystemException {
810 int count = countByUuid(uuid);
811
812 List<AnnouncementsEntry> list = findByUuid(uuid, count - 1, count,
813 orderByComparator);
814
815 if (list.isEmpty()) {
816 StringBundler msg = new StringBundler(4);
817
818 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
819
820 msg.append("uuid=");
821 msg.append(uuid);
822
823 msg.append(StringPool.CLOSE_CURLY_BRACE);
824
825 throw new NoSuchEntryException(msg.toString());
826 }
827 else {
828 return list.get(0);
829 }
830 }
831
832
846 public AnnouncementsEntry[] findByUuid_PrevAndNext(long entryId,
847 String uuid, OrderByComparator orderByComparator)
848 throws NoSuchEntryException, SystemException {
849 AnnouncementsEntry announcementsEntry = findByPrimaryKey(entryId);
850
851 Session session = null;
852
853 try {
854 session = openSession();
855
856 AnnouncementsEntry[] array = new AnnouncementsEntryImpl[3];
857
858 array[0] = getByUuid_PrevAndNext(session, announcementsEntry, uuid,
859 orderByComparator, true);
860
861 array[1] = announcementsEntry;
862
863 array[2] = getByUuid_PrevAndNext(session, announcementsEntry, uuid,
864 orderByComparator, false);
865
866 return array;
867 }
868 catch (Exception e) {
869 throw processException(e);
870 }
871 finally {
872 closeSession(session);
873 }
874 }
875
876 protected AnnouncementsEntry getByUuid_PrevAndNext(Session session,
877 AnnouncementsEntry announcementsEntry, String uuid,
878 OrderByComparator orderByComparator, boolean previous) {
879 StringBundler query = null;
880
881 if (orderByComparator != null) {
882 query = new StringBundler(6 +
883 (orderByComparator.getOrderByFields().length * 6));
884 }
885 else {
886 query = new StringBundler(3);
887 }
888
889 query.append(_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
890
891 if (uuid == null) {
892 query.append(_FINDER_COLUMN_UUID_UUID_1);
893 }
894 else {
895 if (uuid.equals(StringPool.BLANK)) {
896 query.append(_FINDER_COLUMN_UUID_UUID_3);
897 }
898 else {
899 query.append(_FINDER_COLUMN_UUID_UUID_2);
900 }
901 }
902
903 if (orderByComparator != null) {
904 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
905
906 if (orderByConditionFields.length > 0) {
907 query.append(WHERE_AND);
908 }
909
910 for (int i = 0; i < orderByConditionFields.length; i++) {
911 query.append(_ORDER_BY_ENTITY_ALIAS);
912 query.append(orderByConditionFields[i]);
913
914 if ((i + 1) < orderByConditionFields.length) {
915 if (orderByComparator.isAscending() ^ previous) {
916 query.append(WHERE_GREATER_THAN_HAS_NEXT);
917 }
918 else {
919 query.append(WHERE_LESSER_THAN_HAS_NEXT);
920 }
921 }
922 else {
923 if (orderByComparator.isAscending() ^ previous) {
924 query.append(WHERE_GREATER_THAN);
925 }
926 else {
927 query.append(WHERE_LESSER_THAN);
928 }
929 }
930 }
931
932 query.append(ORDER_BY_CLAUSE);
933
934 String[] orderByFields = orderByComparator.getOrderByFields();
935
936 for (int i = 0; i < orderByFields.length; i++) {
937 query.append(_ORDER_BY_ENTITY_ALIAS);
938 query.append(orderByFields[i]);
939
940 if ((i + 1) < orderByFields.length) {
941 if (orderByComparator.isAscending() ^ previous) {
942 query.append(ORDER_BY_ASC_HAS_NEXT);
943 }
944 else {
945 query.append(ORDER_BY_DESC_HAS_NEXT);
946 }
947 }
948 else {
949 if (orderByComparator.isAscending() ^ previous) {
950 query.append(ORDER_BY_ASC);
951 }
952 else {
953 query.append(ORDER_BY_DESC);
954 }
955 }
956 }
957 }
958
959 else {
960 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
961 }
962
963 String sql = query.toString();
964
965 Query q = session.createQuery(sql);
966
967 q.setFirstResult(0);
968 q.setMaxResults(2);
969
970 QueryPos qPos = QueryPos.getInstance(q);
971
972 if (uuid != null) {
973 qPos.add(uuid);
974 }
975
976 if (orderByComparator != null) {
977 Object[] values = orderByComparator.getOrderByConditionValues(announcementsEntry);
978
979 for (Object value : values) {
980 qPos.add(value);
981 }
982 }
983
984 List<AnnouncementsEntry> list = q.list();
985
986 if (list.size() == 2) {
987 return list.get(1);
988 }
989 else {
990 return null;
991 }
992 }
993
994
1001 public List<AnnouncementsEntry> filterFindByUuid(String uuid)
1002 throws SystemException {
1003 return filterFindByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1004 }
1005
1006
1019 public List<AnnouncementsEntry> filterFindByUuid(String uuid, int start,
1020 int end) throws SystemException {
1021 return filterFindByUuid(uuid, start, end, null);
1022 }
1023
1024
1038 public List<AnnouncementsEntry> filterFindByUuid(String uuid, int start,
1039 int end, OrderByComparator orderByComparator) throws SystemException {
1040 if (!InlineSQLHelperUtil.isEnabled()) {
1041 return findByUuid(uuid, start, end, orderByComparator);
1042 }
1043
1044 StringBundler query = null;
1045
1046 if (orderByComparator != null) {
1047 query = new StringBundler(3 +
1048 (orderByComparator.getOrderByFields().length * 3));
1049 }
1050 else {
1051 query = new StringBundler(3);
1052 }
1053
1054 if (getDB().isSupportsInlineDistinct()) {
1055 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
1056 }
1057 else {
1058 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_1);
1059 }
1060
1061 if (uuid == null) {
1062 query.append(_FINDER_COLUMN_UUID_UUID_1);
1063 }
1064 else {
1065 if (uuid.equals(StringPool.BLANK)) {
1066 query.append(_FINDER_COLUMN_UUID_UUID_3);
1067 }
1068 else {
1069 query.append(_FINDER_COLUMN_UUID_UUID_2);
1070 }
1071 }
1072
1073 if (!getDB().isSupportsInlineDistinct()) {
1074 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_2);
1075 }
1076
1077 if (orderByComparator != null) {
1078 if (getDB().isSupportsInlineDistinct()) {
1079 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1080 orderByComparator);
1081 }
1082 else {
1083 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
1084 orderByComparator);
1085 }
1086 }
1087
1088 else {
1089 if (getDB().isSupportsInlineDistinct()) {
1090 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
1091 }
1092 else {
1093 query.append(AnnouncementsEntryModelImpl.ORDER_BY_SQL);
1094 }
1095 }
1096
1097 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1098 AnnouncementsEntry.class.getName(),
1099 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
1100
1101 Session session = null;
1102
1103 try {
1104 session = openSession();
1105
1106 SQLQuery q = session.createSQLQuery(sql);
1107
1108 if (getDB().isSupportsInlineDistinct()) {
1109 q.addEntity(_FILTER_ENTITY_ALIAS, AnnouncementsEntryImpl.class);
1110 }
1111 else {
1112 q.addEntity(_FILTER_ENTITY_TABLE, AnnouncementsEntryImpl.class);
1113 }
1114
1115 QueryPos qPos = QueryPos.getInstance(q);
1116
1117 if (uuid != null) {
1118 qPos.add(uuid);
1119 }
1120
1121 return (List<AnnouncementsEntry>)QueryUtil.list(q, getDialect(),
1122 start, end);
1123 }
1124 catch (Exception e) {
1125 throw processException(e);
1126 }
1127 finally {
1128 closeSession(session);
1129 }
1130 }
1131
1132
1142 public AnnouncementsEntry[] filterFindByUuid_PrevAndNext(long entryId,
1143 String uuid, OrderByComparator orderByComparator)
1144 throws NoSuchEntryException, SystemException {
1145 if (!InlineSQLHelperUtil.isEnabled()) {
1146 return findByUuid_PrevAndNext(entryId, uuid, orderByComparator);
1147 }
1148
1149 AnnouncementsEntry announcementsEntry = findByPrimaryKey(entryId);
1150
1151 Session session = null;
1152
1153 try {
1154 session = openSession();
1155
1156 AnnouncementsEntry[] array = new AnnouncementsEntryImpl[3];
1157
1158 array[0] = filterGetByUuid_PrevAndNext(session, announcementsEntry,
1159 uuid, orderByComparator, true);
1160
1161 array[1] = announcementsEntry;
1162
1163 array[2] = filterGetByUuid_PrevAndNext(session, announcementsEntry,
1164 uuid, orderByComparator, false);
1165
1166 return array;
1167 }
1168 catch (Exception e) {
1169 throw processException(e);
1170 }
1171 finally {
1172 closeSession(session);
1173 }
1174 }
1175
1176 protected AnnouncementsEntry filterGetByUuid_PrevAndNext(Session session,
1177 AnnouncementsEntry announcementsEntry, String uuid,
1178 OrderByComparator orderByComparator, boolean previous) {
1179 StringBundler query = null;
1180
1181 if (orderByComparator != null) {
1182 query = new StringBundler(6 +
1183 (orderByComparator.getOrderByFields().length * 6));
1184 }
1185 else {
1186 query = new StringBundler(3);
1187 }
1188
1189 if (getDB().isSupportsInlineDistinct()) {
1190 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
1191 }
1192 else {
1193 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_1);
1194 }
1195
1196 if (uuid == null) {
1197 query.append(_FINDER_COLUMN_UUID_UUID_1);
1198 }
1199 else {
1200 if (uuid.equals(StringPool.BLANK)) {
1201 query.append(_FINDER_COLUMN_UUID_UUID_3);
1202 }
1203 else {
1204 query.append(_FINDER_COLUMN_UUID_UUID_2);
1205 }
1206 }
1207
1208 if (!getDB().isSupportsInlineDistinct()) {
1209 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_2);
1210 }
1211
1212 if (orderByComparator != null) {
1213 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1214
1215 if (orderByConditionFields.length > 0) {
1216 query.append(WHERE_AND);
1217 }
1218
1219 for (int i = 0; i < orderByConditionFields.length; i++) {
1220 if (getDB().isSupportsInlineDistinct()) {
1221 query.append(_ORDER_BY_ENTITY_ALIAS);
1222 }
1223 else {
1224 query.append(_ORDER_BY_ENTITY_TABLE);
1225 }
1226
1227 query.append(orderByConditionFields[i]);
1228
1229 if ((i + 1) < orderByConditionFields.length) {
1230 if (orderByComparator.isAscending() ^ previous) {
1231 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1232 }
1233 else {
1234 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1235 }
1236 }
1237 else {
1238 if (orderByComparator.isAscending() ^ previous) {
1239 query.append(WHERE_GREATER_THAN);
1240 }
1241 else {
1242 query.append(WHERE_LESSER_THAN);
1243 }
1244 }
1245 }
1246
1247 query.append(ORDER_BY_CLAUSE);
1248
1249 String[] orderByFields = orderByComparator.getOrderByFields();
1250
1251 for (int i = 0; i < orderByFields.length; i++) {
1252 if (getDB().isSupportsInlineDistinct()) {
1253 query.append(_ORDER_BY_ENTITY_ALIAS);
1254 }
1255 else {
1256 query.append(_ORDER_BY_ENTITY_TABLE);
1257 }
1258
1259 query.append(orderByFields[i]);
1260
1261 if ((i + 1) < orderByFields.length) {
1262 if (orderByComparator.isAscending() ^ previous) {
1263 query.append(ORDER_BY_ASC_HAS_NEXT);
1264 }
1265 else {
1266 query.append(ORDER_BY_DESC_HAS_NEXT);
1267 }
1268 }
1269 else {
1270 if (orderByComparator.isAscending() ^ previous) {
1271 query.append(ORDER_BY_ASC);
1272 }
1273 else {
1274 query.append(ORDER_BY_DESC);
1275 }
1276 }
1277 }
1278 }
1279
1280 else {
1281 if (getDB().isSupportsInlineDistinct()) {
1282 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
1283 }
1284 else {
1285 query.append(AnnouncementsEntryModelImpl.ORDER_BY_SQL);
1286 }
1287 }
1288
1289 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1290 AnnouncementsEntry.class.getName(),
1291 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
1292
1293 SQLQuery q = session.createSQLQuery(sql);
1294
1295 q.setFirstResult(0);
1296 q.setMaxResults(2);
1297
1298 if (getDB().isSupportsInlineDistinct()) {
1299 q.addEntity(_FILTER_ENTITY_ALIAS, AnnouncementsEntryImpl.class);
1300 }
1301 else {
1302 q.addEntity(_FILTER_ENTITY_TABLE, AnnouncementsEntryImpl.class);
1303 }
1304
1305 QueryPos qPos = QueryPos.getInstance(q);
1306
1307 if (uuid != null) {
1308 qPos.add(uuid);
1309 }
1310
1311 if (orderByComparator != null) {
1312 Object[] values = orderByComparator.getOrderByConditionValues(announcementsEntry);
1313
1314 for (Object value : values) {
1315 qPos.add(value);
1316 }
1317 }
1318
1319 List<AnnouncementsEntry> list = q.list();
1320
1321 if (list.size() == 2) {
1322 return list.get(1);
1323 }
1324 else {
1325 return null;
1326 }
1327 }
1328
1329
1336 public List<AnnouncementsEntry> findByUserId(long userId)
1337 throws SystemException {
1338 return findByUserId(userId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1339 }
1340
1341
1354 public List<AnnouncementsEntry> findByUserId(long userId, int start, int end)
1355 throws SystemException {
1356 return findByUserId(userId, start, end, null);
1357 }
1358
1359
1373 public List<AnnouncementsEntry> findByUserId(long userId, int start,
1374 int end, OrderByComparator orderByComparator) throws SystemException {
1375 FinderPath finderPath = null;
1376 Object[] finderArgs = null;
1377
1378 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1379 (orderByComparator == null)) {
1380 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID;
1381 finderArgs = new Object[] { userId };
1382 }
1383 else {
1384 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_USERID;
1385 finderArgs = new Object[] { userId, start, end, orderByComparator };
1386 }
1387
1388 List<AnnouncementsEntry> list = (List<AnnouncementsEntry>)FinderCacheUtil.getResult(finderPath,
1389 finderArgs, this);
1390
1391 if (list == null) {
1392 StringBundler query = null;
1393
1394 if (orderByComparator != null) {
1395 query = new StringBundler(3 +
1396 (orderByComparator.getOrderByFields().length * 3));
1397 }
1398 else {
1399 query = new StringBundler(3);
1400 }
1401
1402 query.append(_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
1403
1404 query.append(_FINDER_COLUMN_USERID_USERID_2);
1405
1406 if (orderByComparator != null) {
1407 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1408 orderByComparator);
1409 }
1410
1411 else {
1412 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
1413 }
1414
1415 String sql = query.toString();
1416
1417 Session session = null;
1418
1419 try {
1420 session = openSession();
1421
1422 Query q = session.createQuery(sql);
1423
1424 QueryPos qPos = QueryPos.getInstance(q);
1425
1426 qPos.add(userId);
1427
1428 list = (List<AnnouncementsEntry>)QueryUtil.list(q,
1429 getDialect(), start, end);
1430 }
1431 catch (Exception e) {
1432 throw processException(e);
1433 }
1434 finally {
1435 if (list == null) {
1436 FinderCacheUtil.removeResult(finderPath, finderArgs);
1437 }
1438 else {
1439 cacheResult(list);
1440
1441 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1442 }
1443
1444 closeSession(session);
1445 }
1446 }
1447
1448 return list;
1449 }
1450
1451
1464 public AnnouncementsEntry findByUserId_First(long userId,
1465 OrderByComparator orderByComparator)
1466 throws NoSuchEntryException, SystemException {
1467 List<AnnouncementsEntry> list = findByUserId(userId, 0, 1,
1468 orderByComparator);
1469
1470 if (list.isEmpty()) {
1471 StringBundler msg = new StringBundler(4);
1472
1473 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1474
1475 msg.append("userId=");
1476 msg.append(userId);
1477
1478 msg.append(StringPool.CLOSE_CURLY_BRACE);
1479
1480 throw new NoSuchEntryException(msg.toString());
1481 }
1482 else {
1483 return list.get(0);
1484 }
1485 }
1486
1487
1500 public AnnouncementsEntry findByUserId_Last(long userId,
1501 OrderByComparator orderByComparator)
1502 throws NoSuchEntryException, SystemException {
1503 int count = countByUserId(userId);
1504
1505 List<AnnouncementsEntry> list = findByUserId(userId, count - 1, count,
1506 orderByComparator);
1507
1508 if (list.isEmpty()) {
1509 StringBundler msg = new StringBundler(4);
1510
1511 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1512
1513 msg.append("userId=");
1514 msg.append(userId);
1515
1516 msg.append(StringPool.CLOSE_CURLY_BRACE);
1517
1518 throw new NoSuchEntryException(msg.toString());
1519 }
1520 else {
1521 return list.get(0);
1522 }
1523 }
1524
1525
1539 public AnnouncementsEntry[] findByUserId_PrevAndNext(long entryId,
1540 long userId, OrderByComparator orderByComparator)
1541 throws NoSuchEntryException, SystemException {
1542 AnnouncementsEntry announcementsEntry = findByPrimaryKey(entryId);
1543
1544 Session session = null;
1545
1546 try {
1547 session = openSession();
1548
1549 AnnouncementsEntry[] array = new AnnouncementsEntryImpl[3];
1550
1551 array[0] = getByUserId_PrevAndNext(session, announcementsEntry,
1552 userId, orderByComparator, true);
1553
1554 array[1] = announcementsEntry;
1555
1556 array[2] = getByUserId_PrevAndNext(session, announcementsEntry,
1557 userId, orderByComparator, false);
1558
1559 return array;
1560 }
1561 catch (Exception e) {
1562 throw processException(e);
1563 }
1564 finally {
1565 closeSession(session);
1566 }
1567 }
1568
1569 protected AnnouncementsEntry getByUserId_PrevAndNext(Session session,
1570 AnnouncementsEntry announcementsEntry, long userId,
1571 OrderByComparator orderByComparator, boolean previous) {
1572 StringBundler query = null;
1573
1574 if (orderByComparator != null) {
1575 query = new StringBundler(6 +
1576 (orderByComparator.getOrderByFields().length * 6));
1577 }
1578 else {
1579 query = new StringBundler(3);
1580 }
1581
1582 query.append(_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
1583
1584 query.append(_FINDER_COLUMN_USERID_USERID_2);
1585
1586 if (orderByComparator != null) {
1587 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1588
1589 if (orderByConditionFields.length > 0) {
1590 query.append(WHERE_AND);
1591 }
1592
1593 for (int i = 0; i < orderByConditionFields.length; i++) {
1594 query.append(_ORDER_BY_ENTITY_ALIAS);
1595 query.append(orderByConditionFields[i]);
1596
1597 if ((i + 1) < orderByConditionFields.length) {
1598 if (orderByComparator.isAscending() ^ previous) {
1599 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1600 }
1601 else {
1602 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1603 }
1604 }
1605 else {
1606 if (orderByComparator.isAscending() ^ previous) {
1607 query.append(WHERE_GREATER_THAN);
1608 }
1609 else {
1610 query.append(WHERE_LESSER_THAN);
1611 }
1612 }
1613 }
1614
1615 query.append(ORDER_BY_CLAUSE);
1616
1617 String[] orderByFields = orderByComparator.getOrderByFields();
1618
1619 for (int i = 0; i < orderByFields.length; i++) {
1620 query.append(_ORDER_BY_ENTITY_ALIAS);
1621 query.append(orderByFields[i]);
1622
1623 if ((i + 1) < orderByFields.length) {
1624 if (orderByComparator.isAscending() ^ previous) {
1625 query.append(ORDER_BY_ASC_HAS_NEXT);
1626 }
1627 else {
1628 query.append(ORDER_BY_DESC_HAS_NEXT);
1629 }
1630 }
1631 else {
1632 if (orderByComparator.isAscending() ^ previous) {
1633 query.append(ORDER_BY_ASC);
1634 }
1635 else {
1636 query.append(ORDER_BY_DESC);
1637 }
1638 }
1639 }
1640 }
1641
1642 else {
1643 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
1644 }
1645
1646 String sql = query.toString();
1647
1648 Query q = session.createQuery(sql);
1649
1650 q.setFirstResult(0);
1651 q.setMaxResults(2);
1652
1653 QueryPos qPos = QueryPos.getInstance(q);
1654
1655 qPos.add(userId);
1656
1657 if (orderByComparator != null) {
1658 Object[] values = orderByComparator.getOrderByConditionValues(announcementsEntry);
1659
1660 for (Object value : values) {
1661 qPos.add(value);
1662 }
1663 }
1664
1665 List<AnnouncementsEntry> list = q.list();
1666
1667 if (list.size() == 2) {
1668 return list.get(1);
1669 }
1670 else {
1671 return null;
1672 }
1673 }
1674
1675
1682 public List<AnnouncementsEntry> filterFindByUserId(long userId)
1683 throws SystemException {
1684 return filterFindByUserId(userId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
1685 null);
1686 }
1687
1688
1701 public List<AnnouncementsEntry> filterFindByUserId(long userId, int start,
1702 int end) throws SystemException {
1703 return filterFindByUserId(userId, start, end, null);
1704 }
1705
1706
1720 public List<AnnouncementsEntry> filterFindByUserId(long userId, int start,
1721 int end, OrderByComparator orderByComparator) throws SystemException {
1722 if (!InlineSQLHelperUtil.isEnabled()) {
1723 return findByUserId(userId, start, end, orderByComparator);
1724 }
1725
1726 StringBundler query = null;
1727
1728 if (orderByComparator != null) {
1729 query = new StringBundler(3 +
1730 (orderByComparator.getOrderByFields().length * 3));
1731 }
1732 else {
1733 query = new StringBundler(3);
1734 }
1735
1736 if (getDB().isSupportsInlineDistinct()) {
1737 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
1738 }
1739 else {
1740 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_1);
1741 }
1742
1743 query.append(_FINDER_COLUMN_USERID_USERID_2);
1744
1745 if (!getDB().isSupportsInlineDistinct()) {
1746 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_2);
1747 }
1748
1749 if (orderByComparator != null) {
1750 if (getDB().isSupportsInlineDistinct()) {
1751 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1752 orderByComparator);
1753 }
1754 else {
1755 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
1756 orderByComparator);
1757 }
1758 }
1759
1760 else {
1761 if (getDB().isSupportsInlineDistinct()) {
1762 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
1763 }
1764 else {
1765 query.append(AnnouncementsEntryModelImpl.ORDER_BY_SQL);
1766 }
1767 }
1768
1769 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1770 AnnouncementsEntry.class.getName(),
1771 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
1772
1773 Session session = null;
1774
1775 try {
1776 session = openSession();
1777
1778 SQLQuery q = session.createSQLQuery(sql);
1779
1780 if (getDB().isSupportsInlineDistinct()) {
1781 q.addEntity(_FILTER_ENTITY_ALIAS, AnnouncementsEntryImpl.class);
1782 }
1783 else {
1784 q.addEntity(_FILTER_ENTITY_TABLE, AnnouncementsEntryImpl.class);
1785 }
1786
1787 QueryPos qPos = QueryPos.getInstance(q);
1788
1789 qPos.add(userId);
1790
1791 return (List<AnnouncementsEntry>)QueryUtil.list(q, getDialect(),
1792 start, end);
1793 }
1794 catch (Exception e) {
1795 throw processException(e);
1796 }
1797 finally {
1798 closeSession(session);
1799 }
1800 }
1801
1802
1812 public AnnouncementsEntry[] filterFindByUserId_PrevAndNext(long entryId,
1813 long userId, OrderByComparator orderByComparator)
1814 throws NoSuchEntryException, SystemException {
1815 if (!InlineSQLHelperUtil.isEnabled()) {
1816 return findByUserId_PrevAndNext(entryId, userId, orderByComparator);
1817 }
1818
1819 AnnouncementsEntry announcementsEntry = findByPrimaryKey(entryId);
1820
1821 Session session = null;
1822
1823 try {
1824 session = openSession();
1825
1826 AnnouncementsEntry[] array = new AnnouncementsEntryImpl[3];
1827
1828 array[0] = filterGetByUserId_PrevAndNext(session,
1829 announcementsEntry, userId, orderByComparator, true);
1830
1831 array[1] = announcementsEntry;
1832
1833 array[2] = filterGetByUserId_PrevAndNext(session,
1834 announcementsEntry, userId, orderByComparator, false);
1835
1836 return array;
1837 }
1838 catch (Exception e) {
1839 throw processException(e);
1840 }
1841 finally {
1842 closeSession(session);
1843 }
1844 }
1845
1846 protected AnnouncementsEntry filterGetByUserId_PrevAndNext(
1847 Session session, AnnouncementsEntry announcementsEntry, long userId,
1848 OrderByComparator orderByComparator, boolean previous) {
1849 StringBundler query = null;
1850
1851 if (orderByComparator != null) {
1852 query = new StringBundler(6 +
1853 (orderByComparator.getOrderByFields().length * 6));
1854 }
1855 else {
1856 query = new StringBundler(3);
1857 }
1858
1859 if (getDB().isSupportsInlineDistinct()) {
1860 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
1861 }
1862 else {
1863 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_1);
1864 }
1865
1866 query.append(_FINDER_COLUMN_USERID_USERID_2);
1867
1868 if (!getDB().isSupportsInlineDistinct()) {
1869 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_2);
1870 }
1871
1872 if (orderByComparator != null) {
1873 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1874
1875 if (orderByConditionFields.length > 0) {
1876 query.append(WHERE_AND);
1877 }
1878
1879 for (int i = 0; i < orderByConditionFields.length; i++) {
1880 if (getDB().isSupportsInlineDistinct()) {
1881 query.append(_ORDER_BY_ENTITY_ALIAS);
1882 }
1883 else {
1884 query.append(_ORDER_BY_ENTITY_TABLE);
1885 }
1886
1887 query.append(orderByConditionFields[i]);
1888
1889 if ((i + 1) < orderByConditionFields.length) {
1890 if (orderByComparator.isAscending() ^ previous) {
1891 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1892 }
1893 else {
1894 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1895 }
1896 }
1897 else {
1898 if (orderByComparator.isAscending() ^ previous) {
1899 query.append(WHERE_GREATER_THAN);
1900 }
1901 else {
1902 query.append(WHERE_LESSER_THAN);
1903 }
1904 }
1905 }
1906
1907 query.append(ORDER_BY_CLAUSE);
1908
1909 String[] orderByFields = orderByComparator.getOrderByFields();
1910
1911 for (int i = 0; i < orderByFields.length; i++) {
1912 if (getDB().isSupportsInlineDistinct()) {
1913 query.append(_ORDER_BY_ENTITY_ALIAS);
1914 }
1915 else {
1916 query.append(_ORDER_BY_ENTITY_TABLE);
1917 }
1918
1919 query.append(orderByFields[i]);
1920
1921 if ((i + 1) < orderByFields.length) {
1922 if (orderByComparator.isAscending() ^ previous) {
1923 query.append(ORDER_BY_ASC_HAS_NEXT);
1924 }
1925 else {
1926 query.append(ORDER_BY_DESC_HAS_NEXT);
1927 }
1928 }
1929 else {
1930 if (orderByComparator.isAscending() ^ previous) {
1931 query.append(ORDER_BY_ASC);
1932 }
1933 else {
1934 query.append(ORDER_BY_DESC);
1935 }
1936 }
1937 }
1938 }
1939
1940 else {
1941 if (getDB().isSupportsInlineDistinct()) {
1942 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
1943 }
1944 else {
1945 query.append(AnnouncementsEntryModelImpl.ORDER_BY_SQL);
1946 }
1947 }
1948
1949 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1950 AnnouncementsEntry.class.getName(),
1951 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
1952
1953 SQLQuery q = session.createSQLQuery(sql);
1954
1955 q.setFirstResult(0);
1956 q.setMaxResults(2);
1957
1958 if (getDB().isSupportsInlineDistinct()) {
1959 q.addEntity(_FILTER_ENTITY_ALIAS, AnnouncementsEntryImpl.class);
1960 }
1961 else {
1962 q.addEntity(_FILTER_ENTITY_TABLE, AnnouncementsEntryImpl.class);
1963 }
1964
1965 QueryPos qPos = QueryPos.getInstance(q);
1966
1967 qPos.add(userId);
1968
1969 if (orderByComparator != null) {
1970 Object[] values = orderByComparator.getOrderByConditionValues(announcementsEntry);
1971
1972 for (Object value : values) {
1973 qPos.add(value);
1974 }
1975 }
1976
1977 List<AnnouncementsEntry> list = q.list();
1978
1979 if (list.size() == 2) {
1980 return list.get(1);
1981 }
1982 else {
1983 return null;
1984 }
1985 }
1986
1987
1995 public List<AnnouncementsEntry> findByC_C(long classNameId, long classPK)
1996 throws SystemException {
1997 return findByC_C(classNameId, classPK, QueryUtil.ALL_POS,
1998 QueryUtil.ALL_POS, null);
1999 }
2000
2001
2015 public List<AnnouncementsEntry> findByC_C(long classNameId, long classPK,
2016 int start, int end) throws SystemException {
2017 return findByC_C(classNameId, classPK, start, end, null);
2018 }
2019
2020
2035 public List<AnnouncementsEntry> findByC_C(long classNameId, long classPK,
2036 int start, int end, OrderByComparator orderByComparator)
2037 throws SystemException {
2038 FinderPath finderPath = null;
2039 Object[] finderArgs = null;
2040
2041 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2042 (orderByComparator == null)) {
2043 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C;
2044 finderArgs = new Object[] { classNameId, classPK };
2045 }
2046 else {
2047 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_C;
2048 finderArgs = new Object[] {
2049 classNameId, classPK,
2050
2051 start, end, orderByComparator
2052 };
2053 }
2054
2055 List<AnnouncementsEntry> list = (List<AnnouncementsEntry>)FinderCacheUtil.getResult(finderPath,
2056 finderArgs, this);
2057
2058 if (list == null) {
2059 StringBundler query = null;
2060
2061 if (orderByComparator != null) {
2062 query = new StringBundler(4 +
2063 (orderByComparator.getOrderByFields().length * 3));
2064 }
2065 else {
2066 query = new StringBundler(4);
2067 }
2068
2069 query.append(_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
2070
2071 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
2072
2073 query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
2074
2075 if (orderByComparator != null) {
2076 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2077 orderByComparator);
2078 }
2079
2080 else {
2081 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
2082 }
2083
2084 String sql = query.toString();
2085
2086 Session session = null;
2087
2088 try {
2089 session = openSession();
2090
2091 Query q = session.createQuery(sql);
2092
2093 QueryPos qPos = QueryPos.getInstance(q);
2094
2095 qPos.add(classNameId);
2096
2097 qPos.add(classPK);
2098
2099 list = (List<AnnouncementsEntry>)QueryUtil.list(q,
2100 getDialect(), start, end);
2101 }
2102 catch (Exception e) {
2103 throw processException(e);
2104 }
2105 finally {
2106 if (list == null) {
2107 FinderCacheUtil.removeResult(finderPath, finderArgs);
2108 }
2109 else {
2110 cacheResult(list);
2111
2112 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2113 }
2114
2115 closeSession(session);
2116 }
2117 }
2118
2119 return list;
2120 }
2121
2122
2136 public AnnouncementsEntry findByC_C_First(long classNameId, long classPK,
2137 OrderByComparator orderByComparator)
2138 throws NoSuchEntryException, SystemException {
2139 List<AnnouncementsEntry> list = findByC_C(classNameId, classPK, 0, 1,
2140 orderByComparator);
2141
2142 if (list.isEmpty()) {
2143 StringBundler msg = new StringBundler(6);
2144
2145 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2146
2147 msg.append("classNameId=");
2148 msg.append(classNameId);
2149
2150 msg.append(", classPK=");
2151 msg.append(classPK);
2152
2153 msg.append(StringPool.CLOSE_CURLY_BRACE);
2154
2155 throw new NoSuchEntryException(msg.toString());
2156 }
2157 else {
2158 return list.get(0);
2159 }
2160 }
2161
2162
2176 public AnnouncementsEntry findByC_C_Last(long classNameId, long classPK,
2177 OrderByComparator orderByComparator)
2178 throws NoSuchEntryException, SystemException {
2179 int count = countByC_C(classNameId, classPK);
2180
2181 List<AnnouncementsEntry> list = findByC_C(classNameId, classPK,
2182 count - 1, count, orderByComparator);
2183
2184 if (list.isEmpty()) {
2185 StringBundler msg = new StringBundler(6);
2186
2187 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2188
2189 msg.append("classNameId=");
2190 msg.append(classNameId);
2191
2192 msg.append(", classPK=");
2193 msg.append(classPK);
2194
2195 msg.append(StringPool.CLOSE_CURLY_BRACE);
2196
2197 throw new NoSuchEntryException(msg.toString());
2198 }
2199 else {
2200 return list.get(0);
2201 }
2202 }
2203
2204
2219 public AnnouncementsEntry[] findByC_C_PrevAndNext(long entryId,
2220 long classNameId, long classPK, OrderByComparator orderByComparator)
2221 throws NoSuchEntryException, SystemException {
2222 AnnouncementsEntry announcementsEntry = findByPrimaryKey(entryId);
2223
2224 Session session = null;
2225
2226 try {
2227 session = openSession();
2228
2229 AnnouncementsEntry[] array = new AnnouncementsEntryImpl[3];
2230
2231 array[0] = getByC_C_PrevAndNext(session, announcementsEntry,
2232 classNameId, classPK, orderByComparator, true);
2233
2234 array[1] = announcementsEntry;
2235
2236 array[2] = getByC_C_PrevAndNext(session, announcementsEntry,
2237 classNameId, classPK, orderByComparator, false);
2238
2239 return array;
2240 }
2241 catch (Exception e) {
2242 throw processException(e);
2243 }
2244 finally {
2245 closeSession(session);
2246 }
2247 }
2248
2249 protected AnnouncementsEntry getByC_C_PrevAndNext(Session session,
2250 AnnouncementsEntry announcementsEntry, long classNameId, long classPK,
2251 OrderByComparator orderByComparator, boolean previous) {
2252 StringBundler query = null;
2253
2254 if (orderByComparator != null) {
2255 query = new StringBundler(6 +
2256 (orderByComparator.getOrderByFields().length * 6));
2257 }
2258 else {
2259 query = new StringBundler(3);
2260 }
2261
2262 query.append(_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
2263
2264 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
2265
2266 query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
2267
2268 if (orderByComparator != null) {
2269 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2270
2271 if (orderByConditionFields.length > 0) {
2272 query.append(WHERE_AND);
2273 }
2274
2275 for (int i = 0; i < orderByConditionFields.length; i++) {
2276 query.append(_ORDER_BY_ENTITY_ALIAS);
2277 query.append(orderByConditionFields[i]);
2278
2279 if ((i + 1) < orderByConditionFields.length) {
2280 if (orderByComparator.isAscending() ^ previous) {
2281 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2282 }
2283 else {
2284 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2285 }
2286 }
2287 else {
2288 if (orderByComparator.isAscending() ^ previous) {
2289 query.append(WHERE_GREATER_THAN);
2290 }
2291 else {
2292 query.append(WHERE_LESSER_THAN);
2293 }
2294 }
2295 }
2296
2297 query.append(ORDER_BY_CLAUSE);
2298
2299 String[] orderByFields = orderByComparator.getOrderByFields();
2300
2301 for (int i = 0; i < orderByFields.length; i++) {
2302 query.append(_ORDER_BY_ENTITY_ALIAS);
2303 query.append(orderByFields[i]);
2304
2305 if ((i + 1) < orderByFields.length) {
2306 if (orderByComparator.isAscending() ^ previous) {
2307 query.append(ORDER_BY_ASC_HAS_NEXT);
2308 }
2309 else {
2310 query.append(ORDER_BY_DESC_HAS_NEXT);
2311 }
2312 }
2313 else {
2314 if (orderByComparator.isAscending() ^ previous) {
2315 query.append(ORDER_BY_ASC);
2316 }
2317 else {
2318 query.append(ORDER_BY_DESC);
2319 }
2320 }
2321 }
2322 }
2323
2324 else {
2325 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
2326 }
2327
2328 String sql = query.toString();
2329
2330 Query q = session.createQuery(sql);
2331
2332 q.setFirstResult(0);
2333 q.setMaxResults(2);
2334
2335 QueryPos qPos = QueryPos.getInstance(q);
2336
2337 qPos.add(classNameId);
2338
2339 qPos.add(classPK);
2340
2341 if (orderByComparator != null) {
2342 Object[] values = orderByComparator.getOrderByConditionValues(announcementsEntry);
2343
2344 for (Object value : values) {
2345 qPos.add(value);
2346 }
2347 }
2348
2349 List<AnnouncementsEntry> list = q.list();
2350
2351 if (list.size() == 2) {
2352 return list.get(1);
2353 }
2354 else {
2355 return null;
2356 }
2357 }
2358
2359
2367 public List<AnnouncementsEntry> filterFindByC_C(long classNameId,
2368 long classPK) throws SystemException {
2369 return filterFindByC_C(classNameId, classPK, QueryUtil.ALL_POS,
2370 QueryUtil.ALL_POS, null);
2371 }
2372
2373
2387 public List<AnnouncementsEntry> filterFindByC_C(long classNameId,
2388 long classPK, int start, int end) throws SystemException {
2389 return filterFindByC_C(classNameId, classPK, start, end, null);
2390 }
2391
2392
2407 public List<AnnouncementsEntry> filterFindByC_C(long classNameId,
2408 long classPK, int start, int end, OrderByComparator orderByComparator)
2409 throws SystemException {
2410 if (!InlineSQLHelperUtil.isEnabled()) {
2411 return findByC_C(classNameId, classPK, start, end, orderByComparator);
2412 }
2413
2414 StringBundler query = null;
2415
2416 if (orderByComparator != null) {
2417 query = new StringBundler(4 +
2418 (orderByComparator.getOrderByFields().length * 3));
2419 }
2420 else {
2421 query = new StringBundler(4);
2422 }
2423
2424 if (getDB().isSupportsInlineDistinct()) {
2425 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
2426 }
2427 else {
2428 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_1);
2429 }
2430
2431 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
2432
2433 query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
2434
2435 if (!getDB().isSupportsInlineDistinct()) {
2436 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_2);
2437 }
2438
2439 if (orderByComparator != null) {
2440 if (getDB().isSupportsInlineDistinct()) {
2441 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2442 orderByComparator);
2443 }
2444 else {
2445 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
2446 orderByComparator);
2447 }
2448 }
2449
2450 else {
2451 if (getDB().isSupportsInlineDistinct()) {
2452 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
2453 }
2454 else {
2455 query.append(AnnouncementsEntryModelImpl.ORDER_BY_SQL);
2456 }
2457 }
2458
2459 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2460 AnnouncementsEntry.class.getName(),
2461 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
2462
2463 Session session = null;
2464
2465 try {
2466 session = openSession();
2467
2468 SQLQuery q = session.createSQLQuery(sql);
2469
2470 if (getDB().isSupportsInlineDistinct()) {
2471 q.addEntity(_FILTER_ENTITY_ALIAS, AnnouncementsEntryImpl.class);
2472 }
2473 else {
2474 q.addEntity(_FILTER_ENTITY_TABLE, AnnouncementsEntryImpl.class);
2475 }
2476
2477 QueryPos qPos = QueryPos.getInstance(q);
2478
2479 qPos.add(classNameId);
2480
2481 qPos.add(classPK);
2482
2483 return (List<AnnouncementsEntry>)QueryUtil.list(q, getDialect(),
2484 start, end);
2485 }
2486 catch (Exception e) {
2487 throw processException(e);
2488 }
2489 finally {
2490 closeSession(session);
2491 }
2492 }
2493
2494
2505 public AnnouncementsEntry[] filterFindByC_C_PrevAndNext(long entryId,
2506 long classNameId, long classPK, OrderByComparator orderByComparator)
2507 throws NoSuchEntryException, SystemException {
2508 if (!InlineSQLHelperUtil.isEnabled()) {
2509 return findByC_C_PrevAndNext(entryId, classNameId, classPK,
2510 orderByComparator);
2511 }
2512
2513 AnnouncementsEntry announcementsEntry = findByPrimaryKey(entryId);
2514
2515 Session session = null;
2516
2517 try {
2518 session = openSession();
2519
2520 AnnouncementsEntry[] array = new AnnouncementsEntryImpl[3];
2521
2522 array[0] = filterGetByC_C_PrevAndNext(session, announcementsEntry,
2523 classNameId, classPK, orderByComparator, true);
2524
2525 array[1] = announcementsEntry;
2526
2527 array[2] = filterGetByC_C_PrevAndNext(session, announcementsEntry,
2528 classNameId, classPK, orderByComparator, false);
2529
2530 return array;
2531 }
2532 catch (Exception e) {
2533 throw processException(e);
2534 }
2535 finally {
2536 closeSession(session);
2537 }
2538 }
2539
2540 protected AnnouncementsEntry filterGetByC_C_PrevAndNext(Session session,
2541 AnnouncementsEntry announcementsEntry, long classNameId, long classPK,
2542 OrderByComparator orderByComparator, boolean previous) {
2543 StringBundler query = null;
2544
2545 if (orderByComparator != null) {
2546 query = new StringBundler(6 +
2547 (orderByComparator.getOrderByFields().length * 6));
2548 }
2549 else {
2550 query = new StringBundler(3);
2551 }
2552
2553 if (getDB().isSupportsInlineDistinct()) {
2554 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
2555 }
2556 else {
2557 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_1);
2558 }
2559
2560 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
2561
2562 query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
2563
2564 if (!getDB().isSupportsInlineDistinct()) {
2565 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_2);
2566 }
2567
2568 if (orderByComparator != null) {
2569 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2570
2571 if (orderByConditionFields.length > 0) {
2572 query.append(WHERE_AND);
2573 }
2574
2575 for (int i = 0; i < orderByConditionFields.length; i++) {
2576 if (getDB().isSupportsInlineDistinct()) {
2577 query.append(_ORDER_BY_ENTITY_ALIAS);
2578 }
2579 else {
2580 query.append(_ORDER_BY_ENTITY_TABLE);
2581 }
2582
2583 query.append(orderByConditionFields[i]);
2584
2585 if ((i + 1) < orderByConditionFields.length) {
2586 if (orderByComparator.isAscending() ^ previous) {
2587 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2588 }
2589 else {
2590 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2591 }
2592 }
2593 else {
2594 if (orderByComparator.isAscending() ^ previous) {
2595 query.append(WHERE_GREATER_THAN);
2596 }
2597 else {
2598 query.append(WHERE_LESSER_THAN);
2599 }
2600 }
2601 }
2602
2603 query.append(ORDER_BY_CLAUSE);
2604
2605 String[] orderByFields = orderByComparator.getOrderByFields();
2606
2607 for (int i = 0; i < orderByFields.length; i++) {
2608 if (getDB().isSupportsInlineDistinct()) {
2609 query.append(_ORDER_BY_ENTITY_ALIAS);
2610 }
2611 else {
2612 query.append(_ORDER_BY_ENTITY_TABLE);
2613 }
2614
2615 query.append(orderByFields[i]);
2616
2617 if ((i + 1) < orderByFields.length) {
2618 if (orderByComparator.isAscending() ^ previous) {
2619 query.append(ORDER_BY_ASC_HAS_NEXT);
2620 }
2621 else {
2622 query.append(ORDER_BY_DESC_HAS_NEXT);
2623 }
2624 }
2625 else {
2626 if (orderByComparator.isAscending() ^ previous) {
2627 query.append(ORDER_BY_ASC);
2628 }
2629 else {
2630 query.append(ORDER_BY_DESC);
2631 }
2632 }
2633 }
2634 }
2635
2636 else {
2637 if (getDB().isSupportsInlineDistinct()) {
2638 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
2639 }
2640 else {
2641 query.append(AnnouncementsEntryModelImpl.ORDER_BY_SQL);
2642 }
2643 }
2644
2645 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2646 AnnouncementsEntry.class.getName(),
2647 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
2648
2649 SQLQuery q = session.createSQLQuery(sql);
2650
2651 q.setFirstResult(0);
2652 q.setMaxResults(2);
2653
2654 if (getDB().isSupportsInlineDistinct()) {
2655 q.addEntity(_FILTER_ENTITY_ALIAS, AnnouncementsEntryImpl.class);
2656 }
2657 else {
2658 q.addEntity(_FILTER_ENTITY_TABLE, AnnouncementsEntryImpl.class);
2659 }
2660
2661 QueryPos qPos = QueryPos.getInstance(q);
2662
2663 qPos.add(classNameId);
2664
2665 qPos.add(classPK);
2666
2667 if (orderByComparator != null) {
2668 Object[] values = orderByComparator.getOrderByConditionValues(announcementsEntry);
2669
2670 for (Object value : values) {
2671 qPos.add(value);
2672 }
2673 }
2674
2675 List<AnnouncementsEntry> list = q.list();
2676
2677 if (list.size() == 2) {
2678 return list.get(1);
2679 }
2680 else {
2681 return null;
2682 }
2683 }
2684
2685
2694 public List<AnnouncementsEntry> findByC_C_A(long classNameId, long classPK,
2695 boolean alert) throws SystemException {
2696 return findByC_C_A(classNameId, classPK, alert, QueryUtil.ALL_POS,
2697 QueryUtil.ALL_POS, null);
2698 }
2699
2700
2715 public List<AnnouncementsEntry> findByC_C_A(long classNameId, long classPK,
2716 boolean alert, int start, int end) throws SystemException {
2717 return findByC_C_A(classNameId, classPK, alert, start, end, null);
2718 }
2719
2720
2736 public List<AnnouncementsEntry> findByC_C_A(long classNameId, long classPK,
2737 boolean alert, int start, int end, OrderByComparator orderByComparator)
2738 throws SystemException {
2739 FinderPath finderPath = null;
2740 Object[] finderArgs = null;
2741
2742 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2743 (orderByComparator == null)) {
2744 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_A;
2745 finderArgs = new Object[] { classNameId, classPK, alert };
2746 }
2747 else {
2748 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_C_A;
2749 finderArgs = new Object[] {
2750 classNameId, classPK, alert,
2751
2752 start, end, orderByComparator
2753 };
2754 }
2755
2756 List<AnnouncementsEntry> list = (List<AnnouncementsEntry>)FinderCacheUtil.getResult(finderPath,
2757 finderArgs, this);
2758
2759 if (list == null) {
2760 StringBundler query = null;
2761
2762 if (orderByComparator != null) {
2763 query = new StringBundler(5 +
2764 (orderByComparator.getOrderByFields().length * 3));
2765 }
2766 else {
2767 query = new StringBundler(5);
2768 }
2769
2770 query.append(_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
2771
2772 query.append(_FINDER_COLUMN_C_C_A_CLASSNAMEID_2);
2773
2774 query.append(_FINDER_COLUMN_C_C_A_CLASSPK_2);
2775
2776 query.append(_FINDER_COLUMN_C_C_A_ALERT_2);
2777
2778 if (orderByComparator != null) {
2779 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2780 orderByComparator);
2781 }
2782
2783 else {
2784 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
2785 }
2786
2787 String sql = query.toString();
2788
2789 Session session = null;
2790
2791 try {
2792 session = openSession();
2793
2794 Query q = session.createQuery(sql);
2795
2796 QueryPos qPos = QueryPos.getInstance(q);
2797
2798 qPos.add(classNameId);
2799
2800 qPos.add(classPK);
2801
2802 qPos.add(alert);
2803
2804 list = (List<AnnouncementsEntry>)QueryUtil.list(q,
2805 getDialect(), start, end);
2806 }
2807 catch (Exception e) {
2808 throw processException(e);
2809 }
2810 finally {
2811 if (list == null) {
2812 FinderCacheUtil.removeResult(finderPath, finderArgs);
2813 }
2814 else {
2815 cacheResult(list);
2816
2817 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2818 }
2819
2820 closeSession(session);
2821 }
2822 }
2823
2824 return list;
2825 }
2826
2827
2842 public AnnouncementsEntry findByC_C_A_First(long classNameId, long classPK,
2843 boolean alert, OrderByComparator orderByComparator)
2844 throws NoSuchEntryException, SystemException {
2845 List<AnnouncementsEntry> list = findByC_C_A(classNameId, classPK,
2846 alert, 0, 1, orderByComparator);
2847
2848 if (list.isEmpty()) {
2849 StringBundler msg = new StringBundler(8);
2850
2851 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2852
2853 msg.append("classNameId=");
2854 msg.append(classNameId);
2855
2856 msg.append(", classPK=");
2857 msg.append(classPK);
2858
2859 msg.append(", alert=");
2860 msg.append(alert);
2861
2862 msg.append(StringPool.CLOSE_CURLY_BRACE);
2863
2864 throw new NoSuchEntryException(msg.toString());
2865 }
2866 else {
2867 return list.get(0);
2868 }
2869 }
2870
2871
2886 public AnnouncementsEntry findByC_C_A_Last(long classNameId, long classPK,
2887 boolean alert, OrderByComparator orderByComparator)
2888 throws NoSuchEntryException, SystemException {
2889 int count = countByC_C_A(classNameId, classPK, alert);
2890
2891 List<AnnouncementsEntry> list = findByC_C_A(classNameId, classPK,
2892 alert, count - 1, count, orderByComparator);
2893
2894 if (list.isEmpty()) {
2895 StringBundler msg = new StringBundler(8);
2896
2897 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2898
2899 msg.append("classNameId=");
2900 msg.append(classNameId);
2901
2902 msg.append(", classPK=");
2903 msg.append(classPK);
2904
2905 msg.append(", alert=");
2906 msg.append(alert);
2907
2908 msg.append(StringPool.CLOSE_CURLY_BRACE);
2909
2910 throw new NoSuchEntryException(msg.toString());
2911 }
2912 else {
2913 return list.get(0);
2914 }
2915 }
2916
2917
2933 public AnnouncementsEntry[] findByC_C_A_PrevAndNext(long entryId,
2934 long classNameId, long classPK, boolean alert,
2935 OrderByComparator orderByComparator)
2936 throws NoSuchEntryException, SystemException {
2937 AnnouncementsEntry announcementsEntry = findByPrimaryKey(entryId);
2938
2939 Session session = null;
2940
2941 try {
2942 session = openSession();
2943
2944 AnnouncementsEntry[] array = new AnnouncementsEntryImpl[3];
2945
2946 array[0] = getByC_C_A_PrevAndNext(session, announcementsEntry,
2947 classNameId, classPK, alert, orderByComparator, true);
2948
2949 array[1] = announcementsEntry;
2950
2951 array[2] = getByC_C_A_PrevAndNext(session, announcementsEntry,
2952 classNameId, classPK, alert, orderByComparator, false);
2953
2954 return array;
2955 }
2956 catch (Exception e) {
2957 throw processException(e);
2958 }
2959 finally {
2960 closeSession(session);
2961 }
2962 }
2963
2964 protected AnnouncementsEntry getByC_C_A_PrevAndNext(Session session,
2965 AnnouncementsEntry announcementsEntry, long classNameId, long classPK,
2966 boolean alert, OrderByComparator orderByComparator, boolean previous) {
2967 StringBundler query = null;
2968
2969 if (orderByComparator != null) {
2970 query = new StringBundler(6 +
2971 (orderByComparator.getOrderByFields().length * 6));
2972 }
2973 else {
2974 query = new StringBundler(3);
2975 }
2976
2977 query.append(_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
2978
2979 query.append(_FINDER_COLUMN_C_C_A_CLASSNAMEID_2);
2980
2981 query.append(_FINDER_COLUMN_C_C_A_CLASSPK_2);
2982
2983 query.append(_FINDER_COLUMN_C_C_A_ALERT_2);
2984
2985 if (orderByComparator != null) {
2986 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2987
2988 if (orderByConditionFields.length > 0) {
2989 query.append(WHERE_AND);
2990 }
2991
2992 for (int i = 0; i < orderByConditionFields.length; i++) {
2993 query.append(_ORDER_BY_ENTITY_ALIAS);
2994 query.append(orderByConditionFields[i]);
2995
2996 if ((i + 1) < orderByConditionFields.length) {
2997 if (orderByComparator.isAscending() ^ previous) {
2998 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2999 }
3000 else {
3001 query.append(WHERE_LESSER_THAN_HAS_NEXT);
3002 }
3003 }
3004 else {
3005 if (orderByComparator.isAscending() ^ previous) {
3006 query.append(WHERE_GREATER_THAN);
3007 }
3008 else {
3009 query.append(WHERE_LESSER_THAN);
3010 }
3011 }
3012 }
3013
3014 query.append(ORDER_BY_CLAUSE);
3015
3016 String[] orderByFields = orderByComparator.getOrderByFields();
3017
3018 for (int i = 0; i < orderByFields.length; i++) {
3019 query.append(_ORDER_BY_ENTITY_ALIAS);
3020 query.append(orderByFields[i]);
3021
3022 if ((i + 1) < orderByFields.length) {
3023 if (orderByComparator.isAscending() ^ previous) {
3024 query.append(ORDER_BY_ASC_HAS_NEXT);
3025 }
3026 else {
3027 query.append(ORDER_BY_DESC_HAS_NEXT);
3028 }
3029 }
3030 else {
3031 if (orderByComparator.isAscending() ^ previous) {
3032 query.append(ORDER_BY_ASC);
3033 }
3034 else {
3035 query.append(ORDER_BY_DESC);
3036 }
3037 }
3038 }
3039 }
3040
3041 else {
3042 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
3043 }
3044
3045 String sql = query.toString();
3046
3047 Query q = session.createQuery(sql);
3048
3049 q.setFirstResult(0);
3050 q.setMaxResults(2);
3051
3052 QueryPos qPos = QueryPos.getInstance(q);
3053
3054 qPos.add(classNameId);
3055
3056 qPos.add(classPK);
3057
3058 qPos.add(alert);
3059
3060 if (orderByComparator != null) {
3061 Object[] values = orderByComparator.getOrderByConditionValues(announcementsEntry);
3062
3063 for (Object value : values) {
3064 qPos.add(value);
3065 }
3066 }
3067
3068 List<AnnouncementsEntry> list = q.list();
3069
3070 if (list.size() == 2) {
3071 return list.get(1);
3072 }
3073 else {
3074 return null;
3075 }
3076 }
3077
3078
3087 public List<AnnouncementsEntry> filterFindByC_C_A(long classNameId,
3088 long classPK, boolean alert) throws SystemException {
3089 return filterFindByC_C_A(classNameId, classPK, alert,
3090 QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
3091 }
3092
3093
3108 public List<AnnouncementsEntry> filterFindByC_C_A(long classNameId,
3109 long classPK, boolean alert, int start, int end)
3110 throws SystemException {
3111 return filterFindByC_C_A(classNameId, classPK, alert, start, end, null);
3112 }
3113
3114
3130 public List<AnnouncementsEntry> filterFindByC_C_A(long classNameId,
3131 long classPK, boolean alert, int start, int end,
3132 OrderByComparator orderByComparator) throws SystemException {
3133 if (!InlineSQLHelperUtil.isEnabled()) {
3134 return findByC_C_A(classNameId, classPK, alert, start, end,
3135 orderByComparator);
3136 }
3137
3138 StringBundler query = null;
3139
3140 if (orderByComparator != null) {
3141 query = new StringBundler(5 +
3142 (orderByComparator.getOrderByFields().length * 3));
3143 }
3144 else {
3145 query = new StringBundler(5);
3146 }
3147
3148 if (getDB().isSupportsInlineDistinct()) {
3149 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
3150 }
3151 else {
3152 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_1);
3153 }
3154
3155 query.append(_FINDER_COLUMN_C_C_A_CLASSNAMEID_2);
3156
3157 query.append(_FINDER_COLUMN_C_C_A_CLASSPK_2);
3158
3159 query.append(_FINDER_COLUMN_C_C_A_ALERT_2);
3160
3161 if (!getDB().isSupportsInlineDistinct()) {
3162 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_2);
3163 }
3164
3165 if (orderByComparator != null) {
3166 if (getDB().isSupportsInlineDistinct()) {
3167 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
3168 orderByComparator);
3169 }
3170 else {
3171 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
3172 orderByComparator);
3173 }
3174 }
3175
3176 else {
3177 if (getDB().isSupportsInlineDistinct()) {
3178 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
3179 }
3180 else {
3181 query.append(AnnouncementsEntryModelImpl.ORDER_BY_SQL);
3182 }
3183 }
3184
3185 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3186 AnnouncementsEntry.class.getName(),
3187 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
3188
3189 Session session = null;
3190
3191 try {
3192 session = openSession();
3193
3194 SQLQuery q = session.createSQLQuery(sql);
3195
3196 if (getDB().isSupportsInlineDistinct()) {
3197 q.addEntity(_FILTER_ENTITY_ALIAS, AnnouncementsEntryImpl.class);
3198 }
3199 else {
3200 q.addEntity(_FILTER_ENTITY_TABLE, AnnouncementsEntryImpl.class);
3201 }
3202
3203 QueryPos qPos = QueryPos.getInstance(q);
3204
3205 qPos.add(classNameId);
3206
3207 qPos.add(classPK);
3208
3209 qPos.add(alert);
3210
3211 return (List<AnnouncementsEntry>)QueryUtil.list(q, getDialect(),
3212 start, end);
3213 }
3214 catch (Exception e) {
3215 throw processException(e);
3216 }
3217 finally {
3218 closeSession(session);
3219 }
3220 }
3221
3222
3234 public AnnouncementsEntry[] filterFindByC_C_A_PrevAndNext(long entryId,
3235 long classNameId, long classPK, boolean alert,
3236 OrderByComparator orderByComparator)
3237 throws NoSuchEntryException, SystemException {
3238 if (!InlineSQLHelperUtil.isEnabled()) {
3239 return findByC_C_A_PrevAndNext(entryId, classNameId, classPK,
3240 alert, orderByComparator);
3241 }
3242
3243 AnnouncementsEntry announcementsEntry = findByPrimaryKey(entryId);
3244
3245 Session session = null;
3246
3247 try {
3248 session = openSession();
3249
3250 AnnouncementsEntry[] array = new AnnouncementsEntryImpl[3];
3251
3252 array[0] = filterGetByC_C_A_PrevAndNext(session,
3253 announcementsEntry, classNameId, classPK, alert,
3254 orderByComparator, true);
3255
3256 array[1] = announcementsEntry;
3257
3258 array[2] = filterGetByC_C_A_PrevAndNext(session,
3259 announcementsEntry, classNameId, classPK, alert,
3260 orderByComparator, false);
3261
3262 return array;
3263 }
3264 catch (Exception e) {
3265 throw processException(e);
3266 }
3267 finally {
3268 closeSession(session);
3269 }
3270 }
3271
3272 protected AnnouncementsEntry filterGetByC_C_A_PrevAndNext(Session session,
3273 AnnouncementsEntry announcementsEntry, long classNameId, long classPK,
3274 boolean alert, OrderByComparator orderByComparator, boolean previous) {
3275 StringBundler query = null;
3276
3277 if (orderByComparator != null) {
3278 query = new StringBundler(6 +
3279 (orderByComparator.getOrderByFields().length * 6));
3280 }
3281 else {
3282 query = new StringBundler(3);
3283 }
3284
3285 if (getDB().isSupportsInlineDistinct()) {
3286 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
3287 }
3288 else {
3289 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_1);
3290 }
3291
3292 query.append(_FINDER_COLUMN_C_C_A_CLASSNAMEID_2);
3293
3294 query.append(_FINDER_COLUMN_C_C_A_CLASSPK_2);
3295
3296 query.append(_FINDER_COLUMN_C_C_A_ALERT_2);
3297
3298 if (!getDB().isSupportsInlineDistinct()) {
3299 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_2);
3300 }
3301
3302 if (orderByComparator != null) {
3303 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
3304
3305 if (orderByConditionFields.length > 0) {
3306 query.append(WHERE_AND);
3307 }
3308
3309 for (int i = 0; i < orderByConditionFields.length; i++) {
3310 if (getDB().isSupportsInlineDistinct()) {
3311 query.append(_ORDER_BY_ENTITY_ALIAS);
3312 }
3313 else {
3314 query.append(_ORDER_BY_ENTITY_TABLE);
3315 }
3316
3317 query.append(orderByConditionFields[i]);
3318
3319 if ((i + 1) < orderByConditionFields.length) {
3320 if (orderByComparator.isAscending() ^ previous) {
3321 query.append(WHERE_GREATER_THAN_HAS_NEXT);
3322 }
3323 else {
3324 query.append(WHERE_LESSER_THAN_HAS_NEXT);
3325 }
3326 }
3327 else {
3328 if (orderByComparator.isAscending() ^ previous) {
3329 query.append(WHERE_GREATER_THAN);
3330 }
3331 else {
3332 query.append(WHERE_LESSER_THAN);
3333 }
3334 }
3335 }
3336
3337 query.append(ORDER_BY_CLAUSE);
3338
3339 String[] orderByFields = orderByComparator.getOrderByFields();
3340
3341 for (int i = 0; i < orderByFields.length; i++) {
3342 if (getDB().isSupportsInlineDistinct()) {
3343 query.append(_ORDER_BY_ENTITY_ALIAS);
3344 }
3345 else {
3346 query.append(_ORDER_BY_ENTITY_TABLE);
3347 }
3348
3349 query.append(orderByFields[i]);
3350
3351 if ((i + 1) < orderByFields.length) {
3352 if (orderByComparator.isAscending() ^ previous) {
3353 query.append(ORDER_BY_ASC_HAS_NEXT);
3354 }
3355 else {
3356 query.append(ORDER_BY_DESC_HAS_NEXT);
3357 }
3358 }
3359 else {
3360 if (orderByComparator.isAscending() ^ previous) {
3361 query.append(ORDER_BY_ASC);
3362 }
3363 else {
3364 query.append(ORDER_BY_DESC);
3365 }
3366 }
3367 }
3368 }
3369
3370 else {
3371 if (getDB().isSupportsInlineDistinct()) {
3372 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
3373 }
3374 else {
3375 query.append(AnnouncementsEntryModelImpl.ORDER_BY_SQL);
3376 }
3377 }
3378
3379 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3380 AnnouncementsEntry.class.getName(),
3381 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
3382
3383 SQLQuery q = session.createSQLQuery(sql);
3384
3385 q.setFirstResult(0);
3386 q.setMaxResults(2);
3387
3388 if (getDB().isSupportsInlineDistinct()) {
3389 q.addEntity(_FILTER_ENTITY_ALIAS, AnnouncementsEntryImpl.class);
3390 }
3391 else {
3392 q.addEntity(_FILTER_ENTITY_TABLE, AnnouncementsEntryImpl.class);
3393 }
3394
3395 QueryPos qPos = QueryPos.getInstance(q);
3396
3397 qPos.add(classNameId);
3398
3399 qPos.add(classPK);
3400
3401 qPos.add(alert);
3402
3403 if (orderByComparator != null) {
3404 Object[] values = orderByComparator.getOrderByConditionValues(announcementsEntry);
3405
3406 for (Object value : values) {
3407 qPos.add(value);
3408 }
3409 }
3410
3411 List<AnnouncementsEntry> list = q.list();
3412
3413 if (list.size() == 2) {
3414 return list.get(1);
3415 }
3416 else {
3417 return null;
3418 }
3419 }
3420
3421
3427 public List<AnnouncementsEntry> findAll() throws SystemException {
3428 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
3429 }
3430
3431
3443 public List<AnnouncementsEntry> findAll(int start, int end)
3444 throws SystemException {
3445 return findAll(start, end, null);
3446 }
3447
3448
3461 public List<AnnouncementsEntry> findAll(int start, int end,
3462 OrderByComparator orderByComparator) throws SystemException {
3463 FinderPath finderPath = null;
3464 Object[] finderArgs = new Object[] { start, end, orderByComparator };
3465
3466 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
3467 (orderByComparator == null)) {
3468 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
3469 finderArgs = FINDER_ARGS_EMPTY;
3470 }
3471 else {
3472 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
3473 finderArgs = new Object[] { start, end, orderByComparator };
3474 }
3475
3476 List<AnnouncementsEntry> list = (List<AnnouncementsEntry>)FinderCacheUtil.getResult(finderPath,
3477 finderArgs, this);
3478
3479 if (list == null) {
3480 StringBundler query = null;
3481 String sql = null;
3482
3483 if (orderByComparator != null) {
3484 query = new StringBundler(2 +
3485 (orderByComparator.getOrderByFields().length * 3));
3486
3487 query.append(_SQL_SELECT_ANNOUNCEMENTSENTRY);
3488
3489 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
3490 orderByComparator);
3491
3492 sql = query.toString();
3493 }
3494 else {
3495 sql = _SQL_SELECT_ANNOUNCEMENTSENTRY.concat(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
3496 }
3497
3498 Session session = null;
3499
3500 try {
3501 session = openSession();
3502
3503 Query q = session.createQuery(sql);
3504
3505 if (orderByComparator == null) {
3506 list = (List<AnnouncementsEntry>)QueryUtil.list(q,
3507 getDialect(), start, end, false);
3508
3509 Collections.sort(list);
3510 }
3511 else {
3512 list = (List<AnnouncementsEntry>)QueryUtil.list(q,
3513 getDialect(), start, end);
3514 }
3515 }
3516 catch (Exception e) {
3517 throw processException(e);
3518 }
3519 finally {
3520 if (list == null) {
3521 FinderCacheUtil.removeResult(finderPath, finderArgs);
3522 }
3523 else {
3524 cacheResult(list);
3525
3526 FinderCacheUtil.putResult(finderPath, finderArgs, list);
3527 }
3528
3529 closeSession(session);
3530 }
3531 }
3532
3533 return list;
3534 }
3535
3536
3542 public void removeByUuid(String uuid) throws SystemException {
3543 for (AnnouncementsEntry announcementsEntry : findByUuid(uuid)) {
3544 remove(announcementsEntry);
3545 }
3546 }
3547
3548
3554 public void removeByUserId(long userId) throws SystemException {
3555 for (AnnouncementsEntry announcementsEntry : findByUserId(userId)) {
3556 remove(announcementsEntry);
3557 }
3558 }
3559
3560
3567 public void removeByC_C(long classNameId, long classPK)
3568 throws SystemException {
3569 for (AnnouncementsEntry announcementsEntry : findByC_C(classNameId,
3570 classPK)) {
3571 remove(announcementsEntry);
3572 }
3573 }
3574
3575
3583 public void removeByC_C_A(long classNameId, long classPK, boolean alert)
3584 throws SystemException {
3585 for (AnnouncementsEntry announcementsEntry : findByC_C_A(classNameId,
3586 classPK, alert)) {
3587 remove(announcementsEntry);
3588 }
3589 }
3590
3591
3596 public void removeAll() throws SystemException {
3597 for (AnnouncementsEntry announcementsEntry : findAll()) {
3598 remove(announcementsEntry);
3599 }
3600 }
3601
3602
3609 public int countByUuid(String uuid) throws SystemException {
3610 Object[] finderArgs = new Object[] { uuid };
3611
3612 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
3613 finderArgs, this);
3614
3615 if (count == null) {
3616 StringBundler query = new StringBundler(2);
3617
3618 query.append(_SQL_COUNT_ANNOUNCEMENTSENTRY_WHERE);
3619
3620 if (uuid == null) {
3621 query.append(_FINDER_COLUMN_UUID_UUID_1);
3622 }
3623 else {
3624 if (uuid.equals(StringPool.BLANK)) {
3625 query.append(_FINDER_COLUMN_UUID_UUID_3);
3626 }
3627 else {
3628 query.append(_FINDER_COLUMN_UUID_UUID_2);
3629 }
3630 }
3631
3632 String sql = query.toString();
3633
3634 Session session = null;
3635
3636 try {
3637 session = openSession();
3638
3639 Query q = session.createQuery(sql);
3640
3641 QueryPos qPos = QueryPos.getInstance(q);
3642
3643 if (uuid != null) {
3644 qPos.add(uuid);
3645 }
3646
3647 count = (Long)q.uniqueResult();
3648 }
3649 catch (Exception e) {
3650 throw processException(e);
3651 }
3652 finally {
3653 if (count == null) {
3654 count = Long.valueOf(0);
3655 }
3656
3657 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
3658 finderArgs, count);
3659
3660 closeSession(session);
3661 }
3662 }
3663
3664 return count.intValue();
3665 }
3666
3667
3674 public int filterCountByUuid(String uuid) throws SystemException {
3675 if (!InlineSQLHelperUtil.isEnabled()) {
3676 return countByUuid(uuid);
3677 }
3678
3679 StringBundler query = new StringBundler(2);
3680
3681 query.append(_FILTER_SQL_COUNT_ANNOUNCEMENTSENTRY_WHERE);
3682
3683 if (uuid == null) {
3684 query.append(_FINDER_COLUMN_UUID_UUID_1);
3685 }
3686 else {
3687 if (uuid.equals(StringPool.BLANK)) {
3688 query.append(_FINDER_COLUMN_UUID_UUID_3);
3689 }
3690 else {
3691 query.append(_FINDER_COLUMN_UUID_UUID_2);
3692 }
3693 }
3694
3695 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3696 AnnouncementsEntry.class.getName(),
3697 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
3698
3699 Session session = null;
3700
3701 try {
3702 session = openSession();
3703
3704 SQLQuery q = session.createSQLQuery(sql);
3705
3706 q.addScalar(COUNT_COLUMN_NAME,
3707 com.liferay.portal.kernel.dao.orm.Type.LONG);
3708
3709 QueryPos qPos = QueryPos.getInstance(q);
3710
3711 if (uuid != null) {
3712 qPos.add(uuid);
3713 }
3714
3715 Long count = (Long)q.uniqueResult();
3716
3717 return count.intValue();
3718 }
3719 catch (Exception e) {
3720 throw processException(e);
3721 }
3722 finally {
3723 closeSession(session);
3724 }
3725 }
3726
3727
3734 public int countByUserId(long userId) throws SystemException {
3735 Object[] finderArgs = new Object[] { userId };
3736
3737 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_USERID,
3738 finderArgs, this);
3739
3740 if (count == null) {
3741 StringBundler query = new StringBundler(2);
3742
3743 query.append(_SQL_COUNT_ANNOUNCEMENTSENTRY_WHERE);
3744
3745 query.append(_FINDER_COLUMN_USERID_USERID_2);
3746
3747 String sql = query.toString();
3748
3749 Session session = null;
3750
3751 try {
3752 session = openSession();
3753
3754 Query q = session.createQuery(sql);
3755
3756 QueryPos qPos = QueryPos.getInstance(q);
3757
3758 qPos.add(userId);
3759
3760 count = (Long)q.uniqueResult();
3761 }
3762 catch (Exception e) {
3763 throw processException(e);
3764 }
3765 finally {
3766 if (count == null) {
3767 count = Long.valueOf(0);
3768 }
3769
3770 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_USERID,
3771 finderArgs, count);
3772
3773 closeSession(session);
3774 }
3775 }
3776
3777 return count.intValue();
3778 }
3779
3780
3787 public int filterCountByUserId(long userId) throws SystemException {
3788 if (!InlineSQLHelperUtil.isEnabled()) {
3789 return countByUserId(userId);
3790 }
3791
3792 StringBundler query = new StringBundler(2);
3793
3794 query.append(_FILTER_SQL_COUNT_ANNOUNCEMENTSENTRY_WHERE);
3795
3796 query.append(_FINDER_COLUMN_USERID_USERID_2);
3797
3798 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3799 AnnouncementsEntry.class.getName(),
3800 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
3801
3802 Session session = null;
3803
3804 try {
3805 session = openSession();
3806
3807 SQLQuery q = session.createSQLQuery(sql);
3808
3809 q.addScalar(COUNT_COLUMN_NAME,
3810 com.liferay.portal.kernel.dao.orm.Type.LONG);
3811
3812 QueryPos qPos = QueryPos.getInstance(q);
3813
3814 qPos.add(userId);
3815
3816 Long count = (Long)q.uniqueResult();
3817
3818 return count.intValue();
3819 }
3820 catch (Exception e) {
3821 throw processException(e);
3822 }
3823 finally {
3824 closeSession(session);
3825 }
3826 }
3827
3828
3836 public int countByC_C(long classNameId, long classPK)
3837 throws SystemException {
3838 Object[] finderArgs = new Object[] { classNameId, classPK };
3839
3840 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C,
3841 finderArgs, this);
3842
3843 if (count == null) {
3844 StringBundler query = new StringBundler(3);
3845
3846 query.append(_SQL_COUNT_ANNOUNCEMENTSENTRY_WHERE);
3847
3848 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
3849
3850 query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
3851
3852 String sql = query.toString();
3853
3854 Session session = null;
3855
3856 try {
3857 session = openSession();
3858
3859 Query q = session.createQuery(sql);
3860
3861 QueryPos qPos = QueryPos.getInstance(q);
3862
3863 qPos.add(classNameId);
3864
3865 qPos.add(classPK);
3866
3867 count = (Long)q.uniqueResult();
3868 }
3869 catch (Exception e) {
3870 throw processException(e);
3871 }
3872 finally {
3873 if (count == null) {
3874 count = Long.valueOf(0);
3875 }
3876
3877 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C, finderArgs,
3878 count);
3879
3880 closeSession(session);
3881 }
3882 }
3883
3884 return count.intValue();
3885 }
3886
3887
3895 public int filterCountByC_C(long classNameId, long classPK)
3896 throws SystemException {
3897 if (!InlineSQLHelperUtil.isEnabled()) {
3898 return countByC_C(classNameId, classPK);
3899 }
3900
3901 StringBundler query = new StringBundler(3);
3902
3903 query.append(_FILTER_SQL_COUNT_ANNOUNCEMENTSENTRY_WHERE);
3904
3905 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
3906
3907 query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
3908
3909 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3910 AnnouncementsEntry.class.getName(),
3911 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
3912
3913 Session session = null;
3914
3915 try {
3916 session = openSession();
3917
3918 SQLQuery q = session.createSQLQuery(sql);
3919
3920 q.addScalar(COUNT_COLUMN_NAME,
3921 com.liferay.portal.kernel.dao.orm.Type.LONG);
3922
3923 QueryPos qPos = QueryPos.getInstance(q);
3924
3925 qPos.add(classNameId);
3926
3927 qPos.add(classPK);
3928
3929 Long count = (Long)q.uniqueResult();
3930
3931 return count.intValue();
3932 }
3933 catch (Exception e) {
3934 throw processException(e);
3935 }
3936 finally {
3937 closeSession(session);
3938 }
3939 }
3940
3941
3950 public int countByC_C_A(long classNameId, long classPK, boolean alert)
3951 throws SystemException {
3952 Object[] finderArgs = new Object[] { classNameId, classPK, alert };
3953
3954 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C_A,
3955 finderArgs, this);
3956
3957 if (count == null) {
3958 StringBundler query = new StringBundler(4);
3959
3960 query.append(_SQL_COUNT_ANNOUNCEMENTSENTRY_WHERE);
3961
3962 query.append(_FINDER_COLUMN_C_C_A_CLASSNAMEID_2);
3963
3964 query.append(_FINDER_COLUMN_C_C_A_CLASSPK_2);
3965
3966 query.append(_FINDER_COLUMN_C_C_A_ALERT_2);
3967
3968 String sql = query.toString();
3969
3970 Session session = null;
3971
3972 try {
3973 session = openSession();
3974
3975 Query q = session.createQuery(sql);
3976
3977 QueryPos qPos = QueryPos.getInstance(q);
3978
3979 qPos.add(classNameId);
3980
3981 qPos.add(classPK);
3982
3983 qPos.add(alert);
3984
3985 count = (Long)q.uniqueResult();
3986 }
3987 catch (Exception e) {
3988 throw processException(e);
3989 }
3990 finally {
3991 if (count == null) {
3992 count = Long.valueOf(0);
3993 }
3994
3995 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C_A,
3996 finderArgs, count);
3997
3998 closeSession(session);
3999 }
4000 }
4001
4002 return count.intValue();
4003 }
4004
4005
4014 public int filterCountByC_C_A(long classNameId, long classPK, boolean alert)
4015 throws SystemException {
4016 if (!InlineSQLHelperUtil.isEnabled()) {
4017 return countByC_C_A(classNameId, classPK, alert);
4018 }
4019
4020 StringBundler query = new StringBundler(4);
4021
4022 query.append(_FILTER_SQL_COUNT_ANNOUNCEMENTSENTRY_WHERE);
4023
4024 query.append(_FINDER_COLUMN_C_C_A_CLASSNAMEID_2);
4025
4026 query.append(_FINDER_COLUMN_C_C_A_CLASSPK_2);
4027
4028 query.append(_FINDER_COLUMN_C_C_A_ALERT_2);
4029
4030 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
4031 AnnouncementsEntry.class.getName(),
4032 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
4033
4034 Session session = null;
4035
4036 try {
4037 session = openSession();
4038
4039 SQLQuery q = session.createSQLQuery(sql);
4040
4041 q.addScalar(COUNT_COLUMN_NAME,
4042 com.liferay.portal.kernel.dao.orm.Type.LONG);
4043
4044 QueryPos qPos = QueryPos.getInstance(q);
4045
4046 qPos.add(classNameId);
4047
4048 qPos.add(classPK);
4049
4050 qPos.add(alert);
4051
4052 Long count = (Long)q.uniqueResult();
4053
4054 return count.intValue();
4055 }
4056 catch (Exception e) {
4057 throw processException(e);
4058 }
4059 finally {
4060 closeSession(session);
4061 }
4062 }
4063
4064
4070 public int countAll() throws SystemException {
4071 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
4072 FINDER_ARGS_EMPTY, this);
4073
4074 if (count == null) {
4075 Session session = null;
4076
4077 try {
4078 session = openSession();
4079
4080 Query q = session.createQuery(_SQL_COUNT_ANNOUNCEMENTSENTRY);
4081
4082 count = (Long)q.uniqueResult();
4083 }
4084 catch (Exception e) {
4085 throw processException(e);
4086 }
4087 finally {
4088 if (count == null) {
4089 count = Long.valueOf(0);
4090 }
4091
4092 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
4093 FINDER_ARGS_EMPTY, count);
4094
4095 closeSession(session);
4096 }
4097 }
4098
4099 return count.intValue();
4100 }
4101
4102
4105 public void afterPropertiesSet() {
4106 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
4107 com.liferay.portal.util.PropsUtil.get(
4108 "value.object.listener.com.liferay.portlet.announcements.model.AnnouncementsEntry")));
4109
4110 if (listenerClassNames.length > 0) {
4111 try {
4112 List<ModelListener<AnnouncementsEntry>> listenersList = new ArrayList<ModelListener<AnnouncementsEntry>>();
4113
4114 for (String listenerClassName : listenerClassNames) {
4115 listenersList.add((ModelListener<AnnouncementsEntry>)InstanceFactory.newInstance(
4116 listenerClassName));
4117 }
4118
4119 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
4120 }
4121 catch (Exception e) {
4122 _log.error(e);
4123 }
4124 }
4125 }
4126
4127 public void destroy() {
4128 EntityCacheUtil.removeCache(AnnouncementsEntryImpl.class.getName());
4129 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
4130 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
4131 }
4132
4133 @BeanReference(type = AnnouncementsDeliveryPersistence.class)
4134 protected AnnouncementsDeliveryPersistence announcementsDeliveryPersistence;
4135 @BeanReference(type = AnnouncementsEntryPersistence.class)
4136 protected AnnouncementsEntryPersistence announcementsEntryPersistence;
4137 @BeanReference(type = AnnouncementsFlagPersistence.class)
4138 protected AnnouncementsFlagPersistence announcementsFlagPersistence;
4139 @BeanReference(type = CompanyPersistence.class)
4140 protected CompanyPersistence companyPersistence;
4141 @BeanReference(type = GroupPersistence.class)
4142 protected GroupPersistence groupPersistence;
4143 @BeanReference(type = OrganizationPersistence.class)
4144 protected OrganizationPersistence organizationPersistence;
4145 @BeanReference(type = ResourcePersistence.class)
4146 protected ResourcePersistence resourcePersistence;
4147 @BeanReference(type = RolePersistence.class)
4148 protected RolePersistence rolePersistence;
4149 @BeanReference(type = UserPersistence.class)
4150 protected UserPersistence userPersistence;
4151 @BeanReference(type = UserGroupPersistence.class)
4152 protected UserGroupPersistence userGroupPersistence;
4153 private static final String _SQL_SELECT_ANNOUNCEMENTSENTRY = "SELECT announcementsEntry FROM AnnouncementsEntry announcementsEntry";
4154 private static final String _SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE = "SELECT announcementsEntry FROM AnnouncementsEntry announcementsEntry WHERE ";
4155 private static final String _SQL_COUNT_ANNOUNCEMENTSENTRY = "SELECT COUNT(announcementsEntry) FROM AnnouncementsEntry announcementsEntry";
4156 private static final String _SQL_COUNT_ANNOUNCEMENTSENTRY_WHERE = "SELECT COUNT(announcementsEntry) FROM AnnouncementsEntry announcementsEntry WHERE ";
4157 private static final String _FINDER_COLUMN_UUID_UUID_1 = "announcementsEntry.uuid IS NULL";
4158 private static final String _FINDER_COLUMN_UUID_UUID_2 = "announcementsEntry.uuid = ?";
4159 private static final String _FINDER_COLUMN_UUID_UUID_3 = "(announcementsEntry.uuid IS NULL OR announcementsEntry.uuid = ?)";
4160 private static final String _FINDER_COLUMN_USERID_USERID_2 = "announcementsEntry.userId = ?";
4161 private static final String _FINDER_COLUMN_C_C_CLASSNAMEID_2 = "announcementsEntry.classNameId = ? AND ";
4162 private static final String _FINDER_COLUMN_C_C_CLASSPK_2 = "announcementsEntry.classPK = ?";
4163 private static final String _FINDER_COLUMN_C_C_A_CLASSNAMEID_2 = "announcementsEntry.classNameId = ? AND ";
4164 private static final String _FINDER_COLUMN_C_C_A_CLASSPK_2 = "announcementsEntry.classPK = ? AND ";
4165 private static final String _FINDER_COLUMN_C_C_A_ALERT_2 = "announcementsEntry.alert = ?";
4166 private static final String _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN = "announcementsEntry.entryId";
4167 private static final String _FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE = "SELECT DISTINCT {announcementsEntry.*} FROM AnnouncementsEntry announcementsEntry WHERE ";
4168 private static final String _FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_1 =
4169 "SELECT {AnnouncementsEntry.*} FROM (SELECT DISTINCT announcementsEntry.entryId FROM AnnouncementsEntry announcementsEntry WHERE ";
4170 private static final String _FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_2 =
4171 ") TEMP_TABLE INNER JOIN AnnouncementsEntry ON TEMP_TABLE.entryId = AnnouncementsEntry.entryId";
4172 private static final String _FILTER_SQL_COUNT_ANNOUNCEMENTSENTRY_WHERE = "SELECT COUNT(DISTINCT announcementsEntry.entryId) AS COUNT_VALUE FROM AnnouncementsEntry announcementsEntry WHERE ";
4173 private static final String _FILTER_ENTITY_ALIAS = "announcementsEntry";
4174 private static final String _FILTER_ENTITY_TABLE = "AnnouncementsEntry";
4175 private static final String _ORDER_BY_ENTITY_ALIAS = "announcementsEntry.";
4176 private static final String _ORDER_BY_ENTITY_TABLE = "AnnouncementsEntry.";
4177 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No AnnouncementsEntry exists with the primary key ";
4178 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No AnnouncementsEntry exists with the key {";
4179 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
4180 private static Log _log = LogFactoryUtil.getLog(AnnouncementsEntryPersistenceImpl.class);
4181 private static AnnouncementsEntry _nullAnnouncementsEntry = new AnnouncementsEntryImpl() {
4182 @Override
4183 public Object clone() {
4184 return this;
4185 }
4186
4187 @Override
4188 public CacheModel<AnnouncementsEntry> toCacheModel() {
4189 return _nullAnnouncementsEntryCacheModel;
4190 }
4191 };
4192
4193 private static CacheModel<AnnouncementsEntry> _nullAnnouncementsEntryCacheModel =
4194 new CacheModel<AnnouncementsEntry>() {
4195 public AnnouncementsEntry toEntityModel() {
4196 return _nullAnnouncementsEntry;
4197 }
4198 };
4199 }