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_WITH_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_WITHOUT_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 else {
404 if ((announcementsEntryModelImpl.getColumnBitmask() &
405 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID.getColumnBitmask()) != 0) {
406 Object[] args = new Object[] {
407 announcementsEntryModelImpl.getOriginalUuid()
408 };
409
410 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID, args);
411 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID,
412 args);
413
414 args = new Object[] { announcementsEntryModelImpl.getUuid() };
415
416 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_UUID, args);
417 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID,
418 args);
419 }
420
421 if ((announcementsEntryModelImpl.getColumnBitmask() &
422 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID.getColumnBitmask()) != 0) {
423 Object[] args = new Object[] {
424 Long.valueOf(announcementsEntryModelImpl.getOriginalUserId())
425 };
426
427 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERID, args);
428 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID,
429 args);
430
431 args = new Object[] {
432 Long.valueOf(announcementsEntryModelImpl.getUserId())
433 };
434
435 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_USERID, args);
436 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID,
437 args);
438 }
439
440 if ((announcementsEntryModelImpl.getColumnBitmask() &
441 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C.getColumnBitmask()) != 0) {
442 Object[] args = new Object[] {
443 Long.valueOf(announcementsEntryModelImpl.getOriginalClassNameId()),
444 Long.valueOf(announcementsEntryModelImpl.getOriginalClassPK())
445 };
446
447 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_C, args);
448 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C,
449 args);
450
451 args = new Object[] {
452 Long.valueOf(announcementsEntryModelImpl.getClassNameId()),
453 Long.valueOf(announcementsEntryModelImpl.getClassPK())
454 };
455
456 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_C, args);
457 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C,
458 args);
459 }
460
461 if ((announcementsEntryModelImpl.getColumnBitmask() &
462 FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_A.getColumnBitmask()) != 0) {
463 Object[] args = new Object[] {
464 Long.valueOf(announcementsEntryModelImpl.getOriginalClassNameId()),
465 Long.valueOf(announcementsEntryModelImpl.getOriginalClassPK()),
466 Boolean.valueOf(announcementsEntryModelImpl.getOriginalAlert())
467 };
468
469 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_C_A, args);
470 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_A,
471 args);
472
473 args = new Object[] {
474 Long.valueOf(announcementsEntryModelImpl.getClassNameId()),
475 Long.valueOf(announcementsEntryModelImpl.getClassPK()),
476 Boolean.valueOf(announcementsEntryModelImpl.getAlert())
477 };
478
479 FinderCacheUtil.removeResult(FINDER_PATH_COUNT_BY_C_C_A, args);
480 FinderCacheUtil.removeResult(FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_A,
481 args);
482 }
483 }
484
485 EntityCacheUtil.putResult(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
486 AnnouncementsEntryImpl.class, announcementsEntry.getPrimaryKey(),
487 announcementsEntry);
488
489 return announcementsEntry;
490 }
491
492 protected AnnouncementsEntry toUnwrappedModel(
493 AnnouncementsEntry announcementsEntry) {
494 if (announcementsEntry instanceof AnnouncementsEntryImpl) {
495 return announcementsEntry;
496 }
497
498 AnnouncementsEntryImpl announcementsEntryImpl = new AnnouncementsEntryImpl();
499
500 announcementsEntryImpl.setNew(announcementsEntry.isNew());
501 announcementsEntryImpl.setPrimaryKey(announcementsEntry.getPrimaryKey());
502
503 announcementsEntryImpl.setUuid(announcementsEntry.getUuid());
504 announcementsEntryImpl.setEntryId(announcementsEntry.getEntryId());
505 announcementsEntryImpl.setCompanyId(announcementsEntry.getCompanyId());
506 announcementsEntryImpl.setUserId(announcementsEntry.getUserId());
507 announcementsEntryImpl.setUserName(announcementsEntry.getUserName());
508 announcementsEntryImpl.setCreateDate(announcementsEntry.getCreateDate());
509 announcementsEntryImpl.setModifiedDate(announcementsEntry.getModifiedDate());
510 announcementsEntryImpl.setClassNameId(announcementsEntry.getClassNameId());
511 announcementsEntryImpl.setClassPK(announcementsEntry.getClassPK());
512 announcementsEntryImpl.setTitle(announcementsEntry.getTitle());
513 announcementsEntryImpl.setContent(announcementsEntry.getContent());
514 announcementsEntryImpl.setUrl(announcementsEntry.getUrl());
515 announcementsEntryImpl.setType(announcementsEntry.getType());
516 announcementsEntryImpl.setDisplayDate(announcementsEntry.getDisplayDate());
517 announcementsEntryImpl.setExpirationDate(announcementsEntry.getExpirationDate());
518 announcementsEntryImpl.setPriority(announcementsEntry.getPriority());
519 announcementsEntryImpl.setAlert(announcementsEntry.isAlert());
520
521 return announcementsEntryImpl;
522 }
523
524
532 @Override
533 public AnnouncementsEntry findByPrimaryKey(Serializable primaryKey)
534 throws NoSuchModelException, SystemException {
535 return findByPrimaryKey(((Long)primaryKey).longValue());
536 }
537
538
546 public AnnouncementsEntry findByPrimaryKey(long entryId)
547 throws NoSuchEntryException, SystemException {
548 AnnouncementsEntry announcementsEntry = fetchByPrimaryKey(entryId);
549
550 if (announcementsEntry == null) {
551 if (_log.isWarnEnabled()) {
552 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + entryId);
553 }
554
555 throw new NoSuchEntryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
556 entryId);
557 }
558
559 return announcementsEntry;
560 }
561
562
569 @Override
570 public AnnouncementsEntry fetchByPrimaryKey(Serializable primaryKey)
571 throws SystemException {
572 return fetchByPrimaryKey(((Long)primaryKey).longValue());
573 }
574
575
582 public AnnouncementsEntry fetchByPrimaryKey(long entryId)
583 throws SystemException {
584 AnnouncementsEntry announcementsEntry = (AnnouncementsEntry)EntityCacheUtil.getResult(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
585 AnnouncementsEntryImpl.class, entryId);
586
587 if (announcementsEntry == _nullAnnouncementsEntry) {
588 return null;
589 }
590
591 if (announcementsEntry == null) {
592 Session session = null;
593
594 boolean hasException = false;
595
596 try {
597 session = openSession();
598
599 announcementsEntry = (AnnouncementsEntry)session.get(AnnouncementsEntryImpl.class,
600 Long.valueOf(entryId));
601 }
602 catch (Exception e) {
603 hasException = true;
604
605 throw processException(e);
606 }
607 finally {
608 if (announcementsEntry != null) {
609 cacheResult(announcementsEntry);
610 }
611 else if (!hasException) {
612 EntityCacheUtil.putResult(AnnouncementsEntryModelImpl.ENTITY_CACHE_ENABLED,
613 AnnouncementsEntryImpl.class, entryId,
614 _nullAnnouncementsEntry);
615 }
616
617 closeSession(session);
618 }
619 }
620
621 return announcementsEntry;
622 }
623
624
631 public List<AnnouncementsEntry> findByUuid(String uuid)
632 throws SystemException {
633 return findByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
634 }
635
636
649 public List<AnnouncementsEntry> findByUuid(String uuid, int start, int end)
650 throws SystemException {
651 return findByUuid(uuid, start, end, null);
652 }
653
654
668 public List<AnnouncementsEntry> findByUuid(String uuid, int start, int end,
669 OrderByComparator orderByComparator) throws SystemException {
670 FinderPath finderPath = null;
671 Object[] finderArgs = null;
672
673 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
674 (orderByComparator == null)) {
675 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_UUID;
676 finderArgs = new Object[] { uuid };
677 }
678 else {
679 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_UUID;
680 finderArgs = new Object[] { uuid, start, end, orderByComparator };
681 }
682
683 List<AnnouncementsEntry> list = (List<AnnouncementsEntry>)FinderCacheUtil.getResult(finderPath,
684 finderArgs, this);
685
686 if ((list != null) && !list.isEmpty()) {
687 for (AnnouncementsEntry announcementsEntry : list) {
688 if (!Validator.equals(uuid, announcementsEntry.getUuid())) {
689 list = null;
690
691 break;
692 }
693 }
694 }
695
696 if (list == null) {
697 StringBundler query = null;
698
699 if (orderByComparator != null) {
700 query = new StringBundler(3 +
701 (orderByComparator.getOrderByFields().length * 3));
702 }
703 else {
704 query = new StringBundler(3);
705 }
706
707 query.append(_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
708
709 if (uuid == null) {
710 query.append(_FINDER_COLUMN_UUID_UUID_1);
711 }
712 else {
713 if (uuid.equals(StringPool.BLANK)) {
714 query.append(_FINDER_COLUMN_UUID_UUID_3);
715 }
716 else {
717 query.append(_FINDER_COLUMN_UUID_UUID_2);
718 }
719 }
720
721 if (orderByComparator != null) {
722 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
723 orderByComparator);
724 }
725
726 else {
727 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
728 }
729
730 String sql = query.toString();
731
732 Session session = null;
733
734 try {
735 session = openSession();
736
737 Query q = session.createQuery(sql);
738
739 QueryPos qPos = QueryPos.getInstance(q);
740
741 if (uuid != null) {
742 qPos.add(uuid);
743 }
744
745 list = (List<AnnouncementsEntry>)QueryUtil.list(q,
746 getDialect(), start, end);
747 }
748 catch (Exception e) {
749 throw processException(e);
750 }
751 finally {
752 if (list == null) {
753 FinderCacheUtil.removeResult(finderPath, finderArgs);
754 }
755 else {
756 cacheResult(list);
757
758 FinderCacheUtil.putResult(finderPath, finderArgs, list);
759 }
760
761 closeSession(session);
762 }
763 }
764
765 return list;
766 }
767
768
781 public AnnouncementsEntry findByUuid_First(String uuid,
782 OrderByComparator orderByComparator)
783 throws NoSuchEntryException, SystemException {
784 List<AnnouncementsEntry> list = findByUuid(uuid, 0, 1, orderByComparator);
785
786 if (list.isEmpty()) {
787 StringBundler msg = new StringBundler(4);
788
789 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
790
791 msg.append("uuid=");
792 msg.append(uuid);
793
794 msg.append(StringPool.CLOSE_CURLY_BRACE);
795
796 throw new NoSuchEntryException(msg.toString());
797 }
798 else {
799 return list.get(0);
800 }
801 }
802
803
816 public AnnouncementsEntry findByUuid_Last(String uuid,
817 OrderByComparator orderByComparator)
818 throws NoSuchEntryException, SystemException {
819 int count = countByUuid(uuid);
820
821 List<AnnouncementsEntry> list = findByUuid(uuid, count - 1, count,
822 orderByComparator);
823
824 if (list.isEmpty()) {
825 StringBundler msg = new StringBundler(4);
826
827 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
828
829 msg.append("uuid=");
830 msg.append(uuid);
831
832 msg.append(StringPool.CLOSE_CURLY_BRACE);
833
834 throw new NoSuchEntryException(msg.toString());
835 }
836 else {
837 return list.get(0);
838 }
839 }
840
841
855 public AnnouncementsEntry[] findByUuid_PrevAndNext(long entryId,
856 String uuid, OrderByComparator orderByComparator)
857 throws NoSuchEntryException, SystemException {
858 AnnouncementsEntry announcementsEntry = findByPrimaryKey(entryId);
859
860 Session session = null;
861
862 try {
863 session = openSession();
864
865 AnnouncementsEntry[] array = new AnnouncementsEntryImpl[3];
866
867 array[0] = getByUuid_PrevAndNext(session, announcementsEntry, uuid,
868 orderByComparator, true);
869
870 array[1] = announcementsEntry;
871
872 array[2] = getByUuid_PrevAndNext(session, announcementsEntry, uuid,
873 orderByComparator, false);
874
875 return array;
876 }
877 catch (Exception e) {
878 throw processException(e);
879 }
880 finally {
881 closeSession(session);
882 }
883 }
884
885 protected AnnouncementsEntry getByUuid_PrevAndNext(Session session,
886 AnnouncementsEntry announcementsEntry, String uuid,
887 OrderByComparator orderByComparator, boolean previous) {
888 StringBundler query = null;
889
890 if (orderByComparator != null) {
891 query = new StringBundler(6 +
892 (orderByComparator.getOrderByFields().length * 6));
893 }
894 else {
895 query = new StringBundler(3);
896 }
897
898 query.append(_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
899
900 if (uuid == null) {
901 query.append(_FINDER_COLUMN_UUID_UUID_1);
902 }
903 else {
904 if (uuid.equals(StringPool.BLANK)) {
905 query.append(_FINDER_COLUMN_UUID_UUID_3);
906 }
907 else {
908 query.append(_FINDER_COLUMN_UUID_UUID_2);
909 }
910 }
911
912 if (orderByComparator != null) {
913 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
914
915 if (orderByConditionFields.length > 0) {
916 query.append(WHERE_AND);
917 }
918
919 for (int i = 0; i < orderByConditionFields.length; i++) {
920 query.append(_ORDER_BY_ENTITY_ALIAS);
921 query.append(orderByConditionFields[i]);
922
923 if ((i + 1) < orderByConditionFields.length) {
924 if (orderByComparator.isAscending() ^ previous) {
925 query.append(WHERE_GREATER_THAN_HAS_NEXT);
926 }
927 else {
928 query.append(WHERE_LESSER_THAN_HAS_NEXT);
929 }
930 }
931 else {
932 if (orderByComparator.isAscending() ^ previous) {
933 query.append(WHERE_GREATER_THAN);
934 }
935 else {
936 query.append(WHERE_LESSER_THAN);
937 }
938 }
939 }
940
941 query.append(ORDER_BY_CLAUSE);
942
943 String[] orderByFields = orderByComparator.getOrderByFields();
944
945 for (int i = 0; i < orderByFields.length; i++) {
946 query.append(_ORDER_BY_ENTITY_ALIAS);
947 query.append(orderByFields[i]);
948
949 if ((i + 1) < orderByFields.length) {
950 if (orderByComparator.isAscending() ^ previous) {
951 query.append(ORDER_BY_ASC_HAS_NEXT);
952 }
953 else {
954 query.append(ORDER_BY_DESC_HAS_NEXT);
955 }
956 }
957 else {
958 if (orderByComparator.isAscending() ^ previous) {
959 query.append(ORDER_BY_ASC);
960 }
961 else {
962 query.append(ORDER_BY_DESC);
963 }
964 }
965 }
966 }
967
968 else {
969 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
970 }
971
972 String sql = query.toString();
973
974 Query q = session.createQuery(sql);
975
976 q.setFirstResult(0);
977 q.setMaxResults(2);
978
979 QueryPos qPos = QueryPos.getInstance(q);
980
981 if (uuid != null) {
982 qPos.add(uuid);
983 }
984
985 if (orderByComparator != null) {
986 Object[] values = orderByComparator.getOrderByConditionValues(announcementsEntry);
987
988 for (Object value : values) {
989 qPos.add(value);
990 }
991 }
992
993 List<AnnouncementsEntry> list = q.list();
994
995 if (list.size() == 2) {
996 return list.get(1);
997 }
998 else {
999 return null;
1000 }
1001 }
1002
1003
1010 public List<AnnouncementsEntry> filterFindByUuid(String uuid)
1011 throws SystemException {
1012 return filterFindByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1013 }
1014
1015
1028 public List<AnnouncementsEntry> filterFindByUuid(String uuid, int start,
1029 int end) throws SystemException {
1030 return filterFindByUuid(uuid, start, end, null);
1031 }
1032
1033
1047 public List<AnnouncementsEntry> filterFindByUuid(String uuid, int start,
1048 int end, OrderByComparator orderByComparator) throws SystemException {
1049 if (!InlineSQLHelperUtil.isEnabled()) {
1050 return findByUuid(uuid, start, end, orderByComparator);
1051 }
1052
1053 StringBundler query = null;
1054
1055 if (orderByComparator != null) {
1056 query = new StringBundler(3 +
1057 (orderByComparator.getOrderByFields().length * 3));
1058 }
1059 else {
1060 query = new StringBundler(3);
1061 }
1062
1063 if (getDB().isSupportsInlineDistinct()) {
1064 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
1065 }
1066 else {
1067 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_1);
1068 }
1069
1070 if (uuid == null) {
1071 query.append(_FINDER_COLUMN_UUID_UUID_1);
1072 }
1073 else {
1074 if (uuid.equals(StringPool.BLANK)) {
1075 query.append(_FINDER_COLUMN_UUID_UUID_3);
1076 }
1077 else {
1078 query.append(_FINDER_COLUMN_UUID_UUID_2);
1079 }
1080 }
1081
1082 if (!getDB().isSupportsInlineDistinct()) {
1083 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_2);
1084 }
1085
1086 if (orderByComparator != null) {
1087 if (getDB().isSupportsInlineDistinct()) {
1088 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1089 orderByComparator);
1090 }
1091 else {
1092 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
1093 orderByComparator);
1094 }
1095 }
1096
1097 else {
1098 if (getDB().isSupportsInlineDistinct()) {
1099 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
1100 }
1101 else {
1102 query.append(AnnouncementsEntryModelImpl.ORDER_BY_SQL);
1103 }
1104 }
1105
1106 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1107 AnnouncementsEntry.class.getName(),
1108 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
1109
1110 Session session = null;
1111
1112 try {
1113 session = openSession();
1114
1115 SQLQuery q = session.createSQLQuery(sql);
1116
1117 if (getDB().isSupportsInlineDistinct()) {
1118 q.addEntity(_FILTER_ENTITY_ALIAS, AnnouncementsEntryImpl.class);
1119 }
1120 else {
1121 q.addEntity(_FILTER_ENTITY_TABLE, AnnouncementsEntryImpl.class);
1122 }
1123
1124 QueryPos qPos = QueryPos.getInstance(q);
1125
1126 if (uuid != null) {
1127 qPos.add(uuid);
1128 }
1129
1130 return (List<AnnouncementsEntry>)QueryUtil.list(q, getDialect(),
1131 start, end);
1132 }
1133 catch (Exception e) {
1134 throw processException(e);
1135 }
1136 finally {
1137 closeSession(session);
1138 }
1139 }
1140
1141
1151 public AnnouncementsEntry[] filterFindByUuid_PrevAndNext(long entryId,
1152 String uuid, OrderByComparator orderByComparator)
1153 throws NoSuchEntryException, SystemException {
1154 if (!InlineSQLHelperUtil.isEnabled()) {
1155 return findByUuid_PrevAndNext(entryId, uuid, orderByComparator);
1156 }
1157
1158 AnnouncementsEntry announcementsEntry = findByPrimaryKey(entryId);
1159
1160 Session session = null;
1161
1162 try {
1163 session = openSession();
1164
1165 AnnouncementsEntry[] array = new AnnouncementsEntryImpl[3];
1166
1167 array[0] = filterGetByUuid_PrevAndNext(session, announcementsEntry,
1168 uuid, orderByComparator, true);
1169
1170 array[1] = announcementsEntry;
1171
1172 array[2] = filterGetByUuid_PrevAndNext(session, announcementsEntry,
1173 uuid, orderByComparator, false);
1174
1175 return array;
1176 }
1177 catch (Exception e) {
1178 throw processException(e);
1179 }
1180 finally {
1181 closeSession(session);
1182 }
1183 }
1184
1185 protected AnnouncementsEntry filterGetByUuid_PrevAndNext(Session session,
1186 AnnouncementsEntry announcementsEntry, String uuid,
1187 OrderByComparator orderByComparator, boolean previous) {
1188 StringBundler query = null;
1189
1190 if (orderByComparator != null) {
1191 query = new StringBundler(6 +
1192 (orderByComparator.getOrderByFields().length * 6));
1193 }
1194 else {
1195 query = new StringBundler(3);
1196 }
1197
1198 if (getDB().isSupportsInlineDistinct()) {
1199 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
1200 }
1201 else {
1202 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_1);
1203 }
1204
1205 if (uuid == null) {
1206 query.append(_FINDER_COLUMN_UUID_UUID_1);
1207 }
1208 else {
1209 if (uuid.equals(StringPool.BLANK)) {
1210 query.append(_FINDER_COLUMN_UUID_UUID_3);
1211 }
1212 else {
1213 query.append(_FINDER_COLUMN_UUID_UUID_2);
1214 }
1215 }
1216
1217 if (!getDB().isSupportsInlineDistinct()) {
1218 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_2);
1219 }
1220
1221 if (orderByComparator != null) {
1222 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1223
1224 if (orderByConditionFields.length > 0) {
1225 query.append(WHERE_AND);
1226 }
1227
1228 for (int i = 0; i < orderByConditionFields.length; i++) {
1229 if (getDB().isSupportsInlineDistinct()) {
1230 query.append(_ORDER_BY_ENTITY_ALIAS);
1231 }
1232 else {
1233 query.append(_ORDER_BY_ENTITY_TABLE);
1234 }
1235
1236 query.append(orderByConditionFields[i]);
1237
1238 if ((i + 1) < orderByConditionFields.length) {
1239 if (orderByComparator.isAscending() ^ previous) {
1240 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1241 }
1242 else {
1243 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1244 }
1245 }
1246 else {
1247 if (orderByComparator.isAscending() ^ previous) {
1248 query.append(WHERE_GREATER_THAN);
1249 }
1250 else {
1251 query.append(WHERE_LESSER_THAN);
1252 }
1253 }
1254 }
1255
1256 query.append(ORDER_BY_CLAUSE);
1257
1258 String[] orderByFields = orderByComparator.getOrderByFields();
1259
1260 for (int i = 0; i < orderByFields.length; i++) {
1261 if (getDB().isSupportsInlineDistinct()) {
1262 query.append(_ORDER_BY_ENTITY_ALIAS);
1263 }
1264 else {
1265 query.append(_ORDER_BY_ENTITY_TABLE);
1266 }
1267
1268 query.append(orderByFields[i]);
1269
1270 if ((i + 1) < orderByFields.length) {
1271 if (orderByComparator.isAscending() ^ previous) {
1272 query.append(ORDER_BY_ASC_HAS_NEXT);
1273 }
1274 else {
1275 query.append(ORDER_BY_DESC_HAS_NEXT);
1276 }
1277 }
1278 else {
1279 if (orderByComparator.isAscending() ^ previous) {
1280 query.append(ORDER_BY_ASC);
1281 }
1282 else {
1283 query.append(ORDER_BY_DESC);
1284 }
1285 }
1286 }
1287 }
1288
1289 else {
1290 if (getDB().isSupportsInlineDistinct()) {
1291 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
1292 }
1293 else {
1294 query.append(AnnouncementsEntryModelImpl.ORDER_BY_SQL);
1295 }
1296 }
1297
1298 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1299 AnnouncementsEntry.class.getName(),
1300 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
1301
1302 SQLQuery q = session.createSQLQuery(sql);
1303
1304 q.setFirstResult(0);
1305 q.setMaxResults(2);
1306
1307 if (getDB().isSupportsInlineDistinct()) {
1308 q.addEntity(_FILTER_ENTITY_ALIAS, AnnouncementsEntryImpl.class);
1309 }
1310 else {
1311 q.addEntity(_FILTER_ENTITY_TABLE, AnnouncementsEntryImpl.class);
1312 }
1313
1314 QueryPos qPos = QueryPos.getInstance(q);
1315
1316 if (uuid != null) {
1317 qPos.add(uuid);
1318 }
1319
1320 if (orderByComparator != null) {
1321 Object[] values = orderByComparator.getOrderByConditionValues(announcementsEntry);
1322
1323 for (Object value : values) {
1324 qPos.add(value);
1325 }
1326 }
1327
1328 List<AnnouncementsEntry> list = q.list();
1329
1330 if (list.size() == 2) {
1331 return list.get(1);
1332 }
1333 else {
1334 return null;
1335 }
1336 }
1337
1338
1345 public List<AnnouncementsEntry> findByUserId(long userId)
1346 throws SystemException {
1347 return findByUserId(userId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1348 }
1349
1350
1363 public List<AnnouncementsEntry> findByUserId(long userId, int start, int end)
1364 throws SystemException {
1365 return findByUserId(userId, start, end, null);
1366 }
1367
1368
1382 public List<AnnouncementsEntry> findByUserId(long userId, int start,
1383 int end, OrderByComparator orderByComparator) throws SystemException {
1384 FinderPath finderPath = null;
1385 Object[] finderArgs = null;
1386
1387 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
1388 (orderByComparator == null)) {
1389 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_USERID;
1390 finderArgs = new Object[] { userId };
1391 }
1392 else {
1393 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_USERID;
1394 finderArgs = new Object[] { userId, start, end, orderByComparator };
1395 }
1396
1397 List<AnnouncementsEntry> list = (List<AnnouncementsEntry>)FinderCacheUtil.getResult(finderPath,
1398 finderArgs, this);
1399
1400 if ((list != null) && !list.isEmpty()) {
1401 for (AnnouncementsEntry announcementsEntry : list) {
1402 if ((userId != announcementsEntry.getUserId())) {
1403 list = null;
1404
1405 break;
1406 }
1407 }
1408 }
1409
1410 if (list == null) {
1411 StringBundler query = null;
1412
1413 if (orderByComparator != null) {
1414 query = new StringBundler(3 +
1415 (orderByComparator.getOrderByFields().length * 3));
1416 }
1417 else {
1418 query = new StringBundler(3);
1419 }
1420
1421 query.append(_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
1422
1423 query.append(_FINDER_COLUMN_USERID_USERID_2);
1424
1425 if (orderByComparator != null) {
1426 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1427 orderByComparator);
1428 }
1429
1430 else {
1431 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
1432 }
1433
1434 String sql = query.toString();
1435
1436 Session session = null;
1437
1438 try {
1439 session = openSession();
1440
1441 Query q = session.createQuery(sql);
1442
1443 QueryPos qPos = QueryPos.getInstance(q);
1444
1445 qPos.add(userId);
1446
1447 list = (List<AnnouncementsEntry>)QueryUtil.list(q,
1448 getDialect(), start, end);
1449 }
1450 catch (Exception e) {
1451 throw processException(e);
1452 }
1453 finally {
1454 if (list == null) {
1455 FinderCacheUtil.removeResult(finderPath, finderArgs);
1456 }
1457 else {
1458 cacheResult(list);
1459
1460 FinderCacheUtil.putResult(finderPath, finderArgs, list);
1461 }
1462
1463 closeSession(session);
1464 }
1465 }
1466
1467 return list;
1468 }
1469
1470
1483 public AnnouncementsEntry findByUserId_First(long userId,
1484 OrderByComparator orderByComparator)
1485 throws NoSuchEntryException, SystemException {
1486 List<AnnouncementsEntry> list = findByUserId(userId, 0, 1,
1487 orderByComparator);
1488
1489 if (list.isEmpty()) {
1490 StringBundler msg = new StringBundler(4);
1491
1492 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1493
1494 msg.append("userId=");
1495 msg.append(userId);
1496
1497 msg.append(StringPool.CLOSE_CURLY_BRACE);
1498
1499 throw new NoSuchEntryException(msg.toString());
1500 }
1501 else {
1502 return list.get(0);
1503 }
1504 }
1505
1506
1519 public AnnouncementsEntry findByUserId_Last(long userId,
1520 OrderByComparator orderByComparator)
1521 throws NoSuchEntryException, SystemException {
1522 int count = countByUserId(userId);
1523
1524 List<AnnouncementsEntry> list = findByUserId(userId, count - 1, count,
1525 orderByComparator);
1526
1527 if (list.isEmpty()) {
1528 StringBundler msg = new StringBundler(4);
1529
1530 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1531
1532 msg.append("userId=");
1533 msg.append(userId);
1534
1535 msg.append(StringPool.CLOSE_CURLY_BRACE);
1536
1537 throw new NoSuchEntryException(msg.toString());
1538 }
1539 else {
1540 return list.get(0);
1541 }
1542 }
1543
1544
1558 public AnnouncementsEntry[] findByUserId_PrevAndNext(long entryId,
1559 long userId, OrderByComparator orderByComparator)
1560 throws NoSuchEntryException, SystemException {
1561 AnnouncementsEntry announcementsEntry = findByPrimaryKey(entryId);
1562
1563 Session session = null;
1564
1565 try {
1566 session = openSession();
1567
1568 AnnouncementsEntry[] array = new AnnouncementsEntryImpl[3];
1569
1570 array[0] = getByUserId_PrevAndNext(session, announcementsEntry,
1571 userId, orderByComparator, true);
1572
1573 array[1] = announcementsEntry;
1574
1575 array[2] = getByUserId_PrevAndNext(session, announcementsEntry,
1576 userId, orderByComparator, false);
1577
1578 return array;
1579 }
1580 catch (Exception e) {
1581 throw processException(e);
1582 }
1583 finally {
1584 closeSession(session);
1585 }
1586 }
1587
1588 protected AnnouncementsEntry getByUserId_PrevAndNext(Session session,
1589 AnnouncementsEntry announcementsEntry, long userId,
1590 OrderByComparator orderByComparator, boolean previous) {
1591 StringBundler query = null;
1592
1593 if (orderByComparator != null) {
1594 query = new StringBundler(6 +
1595 (orderByComparator.getOrderByFields().length * 6));
1596 }
1597 else {
1598 query = new StringBundler(3);
1599 }
1600
1601 query.append(_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
1602
1603 query.append(_FINDER_COLUMN_USERID_USERID_2);
1604
1605 if (orderByComparator != null) {
1606 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1607
1608 if (orderByConditionFields.length > 0) {
1609 query.append(WHERE_AND);
1610 }
1611
1612 for (int i = 0; i < orderByConditionFields.length; i++) {
1613 query.append(_ORDER_BY_ENTITY_ALIAS);
1614 query.append(orderByConditionFields[i]);
1615
1616 if ((i + 1) < orderByConditionFields.length) {
1617 if (orderByComparator.isAscending() ^ previous) {
1618 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1619 }
1620 else {
1621 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1622 }
1623 }
1624 else {
1625 if (orderByComparator.isAscending() ^ previous) {
1626 query.append(WHERE_GREATER_THAN);
1627 }
1628 else {
1629 query.append(WHERE_LESSER_THAN);
1630 }
1631 }
1632 }
1633
1634 query.append(ORDER_BY_CLAUSE);
1635
1636 String[] orderByFields = orderByComparator.getOrderByFields();
1637
1638 for (int i = 0; i < orderByFields.length; i++) {
1639 query.append(_ORDER_BY_ENTITY_ALIAS);
1640 query.append(orderByFields[i]);
1641
1642 if ((i + 1) < orderByFields.length) {
1643 if (orderByComparator.isAscending() ^ previous) {
1644 query.append(ORDER_BY_ASC_HAS_NEXT);
1645 }
1646 else {
1647 query.append(ORDER_BY_DESC_HAS_NEXT);
1648 }
1649 }
1650 else {
1651 if (orderByComparator.isAscending() ^ previous) {
1652 query.append(ORDER_BY_ASC);
1653 }
1654 else {
1655 query.append(ORDER_BY_DESC);
1656 }
1657 }
1658 }
1659 }
1660
1661 else {
1662 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
1663 }
1664
1665 String sql = query.toString();
1666
1667 Query q = session.createQuery(sql);
1668
1669 q.setFirstResult(0);
1670 q.setMaxResults(2);
1671
1672 QueryPos qPos = QueryPos.getInstance(q);
1673
1674 qPos.add(userId);
1675
1676 if (orderByComparator != null) {
1677 Object[] values = orderByComparator.getOrderByConditionValues(announcementsEntry);
1678
1679 for (Object value : values) {
1680 qPos.add(value);
1681 }
1682 }
1683
1684 List<AnnouncementsEntry> list = q.list();
1685
1686 if (list.size() == 2) {
1687 return list.get(1);
1688 }
1689 else {
1690 return null;
1691 }
1692 }
1693
1694
1701 public List<AnnouncementsEntry> filterFindByUserId(long userId)
1702 throws SystemException {
1703 return filterFindByUserId(userId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
1704 null);
1705 }
1706
1707
1720 public List<AnnouncementsEntry> filterFindByUserId(long userId, int start,
1721 int end) throws SystemException {
1722 return filterFindByUserId(userId, start, end, null);
1723 }
1724
1725
1739 public List<AnnouncementsEntry> filterFindByUserId(long userId, int start,
1740 int end, OrderByComparator orderByComparator) throws SystemException {
1741 if (!InlineSQLHelperUtil.isEnabled()) {
1742 return findByUserId(userId, start, end, orderByComparator);
1743 }
1744
1745 StringBundler query = null;
1746
1747 if (orderByComparator != null) {
1748 query = new StringBundler(3 +
1749 (orderByComparator.getOrderByFields().length * 3));
1750 }
1751 else {
1752 query = new StringBundler(3);
1753 }
1754
1755 if (getDB().isSupportsInlineDistinct()) {
1756 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
1757 }
1758 else {
1759 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_1);
1760 }
1761
1762 query.append(_FINDER_COLUMN_USERID_USERID_2);
1763
1764 if (!getDB().isSupportsInlineDistinct()) {
1765 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_2);
1766 }
1767
1768 if (orderByComparator != null) {
1769 if (getDB().isSupportsInlineDistinct()) {
1770 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1771 orderByComparator);
1772 }
1773 else {
1774 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
1775 orderByComparator);
1776 }
1777 }
1778
1779 else {
1780 if (getDB().isSupportsInlineDistinct()) {
1781 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
1782 }
1783 else {
1784 query.append(AnnouncementsEntryModelImpl.ORDER_BY_SQL);
1785 }
1786 }
1787
1788 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1789 AnnouncementsEntry.class.getName(),
1790 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
1791
1792 Session session = null;
1793
1794 try {
1795 session = openSession();
1796
1797 SQLQuery q = session.createSQLQuery(sql);
1798
1799 if (getDB().isSupportsInlineDistinct()) {
1800 q.addEntity(_FILTER_ENTITY_ALIAS, AnnouncementsEntryImpl.class);
1801 }
1802 else {
1803 q.addEntity(_FILTER_ENTITY_TABLE, AnnouncementsEntryImpl.class);
1804 }
1805
1806 QueryPos qPos = QueryPos.getInstance(q);
1807
1808 qPos.add(userId);
1809
1810 return (List<AnnouncementsEntry>)QueryUtil.list(q, getDialect(),
1811 start, end);
1812 }
1813 catch (Exception e) {
1814 throw processException(e);
1815 }
1816 finally {
1817 closeSession(session);
1818 }
1819 }
1820
1821
1831 public AnnouncementsEntry[] filterFindByUserId_PrevAndNext(long entryId,
1832 long userId, OrderByComparator orderByComparator)
1833 throws NoSuchEntryException, SystemException {
1834 if (!InlineSQLHelperUtil.isEnabled()) {
1835 return findByUserId_PrevAndNext(entryId, userId, orderByComparator);
1836 }
1837
1838 AnnouncementsEntry announcementsEntry = findByPrimaryKey(entryId);
1839
1840 Session session = null;
1841
1842 try {
1843 session = openSession();
1844
1845 AnnouncementsEntry[] array = new AnnouncementsEntryImpl[3];
1846
1847 array[0] = filterGetByUserId_PrevAndNext(session,
1848 announcementsEntry, userId, orderByComparator, true);
1849
1850 array[1] = announcementsEntry;
1851
1852 array[2] = filterGetByUserId_PrevAndNext(session,
1853 announcementsEntry, userId, orderByComparator, false);
1854
1855 return array;
1856 }
1857 catch (Exception e) {
1858 throw processException(e);
1859 }
1860 finally {
1861 closeSession(session);
1862 }
1863 }
1864
1865 protected AnnouncementsEntry filterGetByUserId_PrevAndNext(
1866 Session session, AnnouncementsEntry announcementsEntry, long userId,
1867 OrderByComparator orderByComparator, boolean previous) {
1868 StringBundler query = null;
1869
1870 if (orderByComparator != null) {
1871 query = new StringBundler(6 +
1872 (orderByComparator.getOrderByFields().length * 6));
1873 }
1874 else {
1875 query = new StringBundler(3);
1876 }
1877
1878 if (getDB().isSupportsInlineDistinct()) {
1879 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
1880 }
1881 else {
1882 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_1);
1883 }
1884
1885 query.append(_FINDER_COLUMN_USERID_USERID_2);
1886
1887 if (!getDB().isSupportsInlineDistinct()) {
1888 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_2);
1889 }
1890
1891 if (orderByComparator != null) {
1892 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
1893
1894 if (orderByConditionFields.length > 0) {
1895 query.append(WHERE_AND);
1896 }
1897
1898 for (int i = 0; i < orderByConditionFields.length; i++) {
1899 if (getDB().isSupportsInlineDistinct()) {
1900 query.append(_ORDER_BY_ENTITY_ALIAS);
1901 }
1902 else {
1903 query.append(_ORDER_BY_ENTITY_TABLE);
1904 }
1905
1906 query.append(orderByConditionFields[i]);
1907
1908 if ((i + 1) < orderByConditionFields.length) {
1909 if (orderByComparator.isAscending() ^ previous) {
1910 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1911 }
1912 else {
1913 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1914 }
1915 }
1916 else {
1917 if (orderByComparator.isAscending() ^ previous) {
1918 query.append(WHERE_GREATER_THAN);
1919 }
1920 else {
1921 query.append(WHERE_LESSER_THAN);
1922 }
1923 }
1924 }
1925
1926 query.append(ORDER_BY_CLAUSE);
1927
1928 String[] orderByFields = orderByComparator.getOrderByFields();
1929
1930 for (int i = 0; i < orderByFields.length; i++) {
1931 if (getDB().isSupportsInlineDistinct()) {
1932 query.append(_ORDER_BY_ENTITY_ALIAS);
1933 }
1934 else {
1935 query.append(_ORDER_BY_ENTITY_TABLE);
1936 }
1937
1938 query.append(orderByFields[i]);
1939
1940 if ((i + 1) < orderByFields.length) {
1941 if (orderByComparator.isAscending() ^ previous) {
1942 query.append(ORDER_BY_ASC_HAS_NEXT);
1943 }
1944 else {
1945 query.append(ORDER_BY_DESC_HAS_NEXT);
1946 }
1947 }
1948 else {
1949 if (orderByComparator.isAscending() ^ previous) {
1950 query.append(ORDER_BY_ASC);
1951 }
1952 else {
1953 query.append(ORDER_BY_DESC);
1954 }
1955 }
1956 }
1957 }
1958
1959 else {
1960 if (getDB().isSupportsInlineDistinct()) {
1961 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
1962 }
1963 else {
1964 query.append(AnnouncementsEntryModelImpl.ORDER_BY_SQL);
1965 }
1966 }
1967
1968 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1969 AnnouncementsEntry.class.getName(),
1970 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
1971
1972 SQLQuery q = session.createSQLQuery(sql);
1973
1974 q.setFirstResult(0);
1975 q.setMaxResults(2);
1976
1977 if (getDB().isSupportsInlineDistinct()) {
1978 q.addEntity(_FILTER_ENTITY_ALIAS, AnnouncementsEntryImpl.class);
1979 }
1980 else {
1981 q.addEntity(_FILTER_ENTITY_TABLE, AnnouncementsEntryImpl.class);
1982 }
1983
1984 QueryPos qPos = QueryPos.getInstance(q);
1985
1986 qPos.add(userId);
1987
1988 if (orderByComparator != null) {
1989 Object[] values = orderByComparator.getOrderByConditionValues(announcementsEntry);
1990
1991 for (Object value : values) {
1992 qPos.add(value);
1993 }
1994 }
1995
1996 List<AnnouncementsEntry> list = q.list();
1997
1998 if (list.size() == 2) {
1999 return list.get(1);
2000 }
2001 else {
2002 return null;
2003 }
2004 }
2005
2006
2014 public List<AnnouncementsEntry> findByC_C(long classNameId, long classPK)
2015 throws SystemException {
2016 return findByC_C(classNameId, classPK, QueryUtil.ALL_POS,
2017 QueryUtil.ALL_POS, null);
2018 }
2019
2020
2034 public List<AnnouncementsEntry> findByC_C(long classNameId, long classPK,
2035 int start, int end) throws SystemException {
2036 return findByC_C(classNameId, classPK, start, end, null);
2037 }
2038
2039
2054 public List<AnnouncementsEntry> findByC_C(long classNameId, long classPK,
2055 int start, int end, OrderByComparator orderByComparator)
2056 throws SystemException {
2057 FinderPath finderPath = null;
2058 Object[] finderArgs = null;
2059
2060 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2061 (orderByComparator == null)) {
2062 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C;
2063 finderArgs = new Object[] { classNameId, classPK };
2064 }
2065 else {
2066 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_C;
2067 finderArgs = new Object[] {
2068 classNameId, classPK,
2069
2070 start, end, orderByComparator
2071 };
2072 }
2073
2074 List<AnnouncementsEntry> list = (List<AnnouncementsEntry>)FinderCacheUtil.getResult(finderPath,
2075 finderArgs, this);
2076
2077 if ((list != null) && !list.isEmpty()) {
2078 for (AnnouncementsEntry announcementsEntry : list) {
2079 if ((classNameId != announcementsEntry.getClassNameId()) ||
2080 (classPK != announcementsEntry.getClassPK())) {
2081 list = null;
2082
2083 break;
2084 }
2085 }
2086 }
2087
2088 if (list == null) {
2089 StringBundler query = null;
2090
2091 if (orderByComparator != null) {
2092 query = new StringBundler(4 +
2093 (orderByComparator.getOrderByFields().length * 3));
2094 }
2095 else {
2096 query = new StringBundler(4);
2097 }
2098
2099 query.append(_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
2100
2101 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
2102
2103 query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
2104
2105 if (orderByComparator != null) {
2106 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2107 orderByComparator);
2108 }
2109
2110 else {
2111 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
2112 }
2113
2114 String sql = query.toString();
2115
2116 Session session = null;
2117
2118 try {
2119 session = openSession();
2120
2121 Query q = session.createQuery(sql);
2122
2123 QueryPos qPos = QueryPos.getInstance(q);
2124
2125 qPos.add(classNameId);
2126
2127 qPos.add(classPK);
2128
2129 list = (List<AnnouncementsEntry>)QueryUtil.list(q,
2130 getDialect(), start, end);
2131 }
2132 catch (Exception e) {
2133 throw processException(e);
2134 }
2135 finally {
2136 if (list == null) {
2137 FinderCacheUtil.removeResult(finderPath, finderArgs);
2138 }
2139 else {
2140 cacheResult(list);
2141
2142 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2143 }
2144
2145 closeSession(session);
2146 }
2147 }
2148
2149 return list;
2150 }
2151
2152
2166 public AnnouncementsEntry findByC_C_First(long classNameId, long classPK,
2167 OrderByComparator orderByComparator)
2168 throws NoSuchEntryException, SystemException {
2169 List<AnnouncementsEntry> list = findByC_C(classNameId, classPK, 0, 1,
2170 orderByComparator);
2171
2172 if (list.isEmpty()) {
2173 StringBundler msg = new StringBundler(6);
2174
2175 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2176
2177 msg.append("classNameId=");
2178 msg.append(classNameId);
2179
2180 msg.append(", classPK=");
2181 msg.append(classPK);
2182
2183 msg.append(StringPool.CLOSE_CURLY_BRACE);
2184
2185 throw new NoSuchEntryException(msg.toString());
2186 }
2187 else {
2188 return list.get(0);
2189 }
2190 }
2191
2192
2206 public AnnouncementsEntry findByC_C_Last(long classNameId, long classPK,
2207 OrderByComparator orderByComparator)
2208 throws NoSuchEntryException, SystemException {
2209 int count = countByC_C(classNameId, classPK);
2210
2211 List<AnnouncementsEntry> list = findByC_C(classNameId, classPK,
2212 count - 1, count, orderByComparator);
2213
2214 if (list.isEmpty()) {
2215 StringBundler msg = new StringBundler(6);
2216
2217 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2218
2219 msg.append("classNameId=");
2220 msg.append(classNameId);
2221
2222 msg.append(", classPK=");
2223 msg.append(classPK);
2224
2225 msg.append(StringPool.CLOSE_CURLY_BRACE);
2226
2227 throw new NoSuchEntryException(msg.toString());
2228 }
2229 else {
2230 return list.get(0);
2231 }
2232 }
2233
2234
2249 public AnnouncementsEntry[] findByC_C_PrevAndNext(long entryId,
2250 long classNameId, long classPK, OrderByComparator orderByComparator)
2251 throws NoSuchEntryException, SystemException {
2252 AnnouncementsEntry announcementsEntry = findByPrimaryKey(entryId);
2253
2254 Session session = null;
2255
2256 try {
2257 session = openSession();
2258
2259 AnnouncementsEntry[] array = new AnnouncementsEntryImpl[3];
2260
2261 array[0] = getByC_C_PrevAndNext(session, announcementsEntry,
2262 classNameId, classPK, orderByComparator, true);
2263
2264 array[1] = announcementsEntry;
2265
2266 array[2] = getByC_C_PrevAndNext(session, announcementsEntry,
2267 classNameId, classPK, orderByComparator, false);
2268
2269 return array;
2270 }
2271 catch (Exception e) {
2272 throw processException(e);
2273 }
2274 finally {
2275 closeSession(session);
2276 }
2277 }
2278
2279 protected AnnouncementsEntry getByC_C_PrevAndNext(Session session,
2280 AnnouncementsEntry announcementsEntry, long classNameId, long classPK,
2281 OrderByComparator orderByComparator, boolean previous) {
2282 StringBundler query = null;
2283
2284 if (orderByComparator != null) {
2285 query = new StringBundler(6 +
2286 (orderByComparator.getOrderByFields().length * 6));
2287 }
2288 else {
2289 query = new StringBundler(3);
2290 }
2291
2292 query.append(_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
2293
2294 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
2295
2296 query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
2297
2298 if (orderByComparator != null) {
2299 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2300
2301 if (orderByConditionFields.length > 0) {
2302 query.append(WHERE_AND);
2303 }
2304
2305 for (int i = 0; i < orderByConditionFields.length; i++) {
2306 query.append(_ORDER_BY_ENTITY_ALIAS);
2307 query.append(orderByConditionFields[i]);
2308
2309 if ((i + 1) < orderByConditionFields.length) {
2310 if (orderByComparator.isAscending() ^ previous) {
2311 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2312 }
2313 else {
2314 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2315 }
2316 }
2317 else {
2318 if (orderByComparator.isAscending() ^ previous) {
2319 query.append(WHERE_GREATER_THAN);
2320 }
2321 else {
2322 query.append(WHERE_LESSER_THAN);
2323 }
2324 }
2325 }
2326
2327 query.append(ORDER_BY_CLAUSE);
2328
2329 String[] orderByFields = orderByComparator.getOrderByFields();
2330
2331 for (int i = 0; i < orderByFields.length; i++) {
2332 query.append(_ORDER_BY_ENTITY_ALIAS);
2333 query.append(orderByFields[i]);
2334
2335 if ((i + 1) < orderByFields.length) {
2336 if (orderByComparator.isAscending() ^ previous) {
2337 query.append(ORDER_BY_ASC_HAS_NEXT);
2338 }
2339 else {
2340 query.append(ORDER_BY_DESC_HAS_NEXT);
2341 }
2342 }
2343 else {
2344 if (orderByComparator.isAscending() ^ previous) {
2345 query.append(ORDER_BY_ASC);
2346 }
2347 else {
2348 query.append(ORDER_BY_DESC);
2349 }
2350 }
2351 }
2352 }
2353
2354 else {
2355 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
2356 }
2357
2358 String sql = query.toString();
2359
2360 Query q = session.createQuery(sql);
2361
2362 q.setFirstResult(0);
2363 q.setMaxResults(2);
2364
2365 QueryPos qPos = QueryPos.getInstance(q);
2366
2367 qPos.add(classNameId);
2368
2369 qPos.add(classPK);
2370
2371 if (orderByComparator != null) {
2372 Object[] values = orderByComparator.getOrderByConditionValues(announcementsEntry);
2373
2374 for (Object value : values) {
2375 qPos.add(value);
2376 }
2377 }
2378
2379 List<AnnouncementsEntry> list = q.list();
2380
2381 if (list.size() == 2) {
2382 return list.get(1);
2383 }
2384 else {
2385 return null;
2386 }
2387 }
2388
2389
2397 public List<AnnouncementsEntry> filterFindByC_C(long classNameId,
2398 long classPK) throws SystemException {
2399 return filterFindByC_C(classNameId, classPK, QueryUtil.ALL_POS,
2400 QueryUtil.ALL_POS, null);
2401 }
2402
2403
2417 public List<AnnouncementsEntry> filterFindByC_C(long classNameId,
2418 long classPK, int start, int end) throws SystemException {
2419 return filterFindByC_C(classNameId, classPK, start, end, null);
2420 }
2421
2422
2437 public List<AnnouncementsEntry> filterFindByC_C(long classNameId,
2438 long classPK, int start, int end, OrderByComparator orderByComparator)
2439 throws SystemException {
2440 if (!InlineSQLHelperUtil.isEnabled()) {
2441 return findByC_C(classNameId, classPK, start, end, orderByComparator);
2442 }
2443
2444 StringBundler query = null;
2445
2446 if (orderByComparator != null) {
2447 query = new StringBundler(4 +
2448 (orderByComparator.getOrderByFields().length * 3));
2449 }
2450 else {
2451 query = new StringBundler(4);
2452 }
2453
2454 if (getDB().isSupportsInlineDistinct()) {
2455 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
2456 }
2457 else {
2458 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_1);
2459 }
2460
2461 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
2462
2463 query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
2464
2465 if (!getDB().isSupportsInlineDistinct()) {
2466 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_2);
2467 }
2468
2469 if (orderByComparator != null) {
2470 if (getDB().isSupportsInlineDistinct()) {
2471 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2472 orderByComparator);
2473 }
2474 else {
2475 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
2476 orderByComparator);
2477 }
2478 }
2479
2480 else {
2481 if (getDB().isSupportsInlineDistinct()) {
2482 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
2483 }
2484 else {
2485 query.append(AnnouncementsEntryModelImpl.ORDER_BY_SQL);
2486 }
2487 }
2488
2489 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2490 AnnouncementsEntry.class.getName(),
2491 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
2492
2493 Session session = null;
2494
2495 try {
2496 session = openSession();
2497
2498 SQLQuery q = session.createSQLQuery(sql);
2499
2500 if (getDB().isSupportsInlineDistinct()) {
2501 q.addEntity(_FILTER_ENTITY_ALIAS, AnnouncementsEntryImpl.class);
2502 }
2503 else {
2504 q.addEntity(_FILTER_ENTITY_TABLE, AnnouncementsEntryImpl.class);
2505 }
2506
2507 QueryPos qPos = QueryPos.getInstance(q);
2508
2509 qPos.add(classNameId);
2510
2511 qPos.add(classPK);
2512
2513 return (List<AnnouncementsEntry>)QueryUtil.list(q, getDialect(),
2514 start, end);
2515 }
2516 catch (Exception e) {
2517 throw processException(e);
2518 }
2519 finally {
2520 closeSession(session);
2521 }
2522 }
2523
2524
2535 public AnnouncementsEntry[] filterFindByC_C_PrevAndNext(long entryId,
2536 long classNameId, long classPK, OrderByComparator orderByComparator)
2537 throws NoSuchEntryException, SystemException {
2538 if (!InlineSQLHelperUtil.isEnabled()) {
2539 return findByC_C_PrevAndNext(entryId, classNameId, classPK,
2540 orderByComparator);
2541 }
2542
2543 AnnouncementsEntry announcementsEntry = findByPrimaryKey(entryId);
2544
2545 Session session = null;
2546
2547 try {
2548 session = openSession();
2549
2550 AnnouncementsEntry[] array = new AnnouncementsEntryImpl[3];
2551
2552 array[0] = filterGetByC_C_PrevAndNext(session, announcementsEntry,
2553 classNameId, classPK, orderByComparator, true);
2554
2555 array[1] = announcementsEntry;
2556
2557 array[2] = filterGetByC_C_PrevAndNext(session, announcementsEntry,
2558 classNameId, classPK, orderByComparator, false);
2559
2560 return array;
2561 }
2562 catch (Exception e) {
2563 throw processException(e);
2564 }
2565 finally {
2566 closeSession(session);
2567 }
2568 }
2569
2570 protected AnnouncementsEntry filterGetByC_C_PrevAndNext(Session session,
2571 AnnouncementsEntry announcementsEntry, long classNameId, long classPK,
2572 OrderByComparator orderByComparator, boolean previous) {
2573 StringBundler query = null;
2574
2575 if (orderByComparator != null) {
2576 query = new StringBundler(6 +
2577 (orderByComparator.getOrderByFields().length * 6));
2578 }
2579 else {
2580 query = new StringBundler(3);
2581 }
2582
2583 if (getDB().isSupportsInlineDistinct()) {
2584 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
2585 }
2586 else {
2587 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_1);
2588 }
2589
2590 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
2591
2592 query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
2593
2594 if (!getDB().isSupportsInlineDistinct()) {
2595 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_2);
2596 }
2597
2598 if (orderByComparator != null) {
2599 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
2600
2601 if (orderByConditionFields.length > 0) {
2602 query.append(WHERE_AND);
2603 }
2604
2605 for (int i = 0; i < orderByConditionFields.length; i++) {
2606 if (getDB().isSupportsInlineDistinct()) {
2607 query.append(_ORDER_BY_ENTITY_ALIAS);
2608 }
2609 else {
2610 query.append(_ORDER_BY_ENTITY_TABLE);
2611 }
2612
2613 query.append(orderByConditionFields[i]);
2614
2615 if ((i + 1) < orderByConditionFields.length) {
2616 if (orderByComparator.isAscending() ^ previous) {
2617 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2618 }
2619 else {
2620 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2621 }
2622 }
2623 else {
2624 if (orderByComparator.isAscending() ^ previous) {
2625 query.append(WHERE_GREATER_THAN);
2626 }
2627 else {
2628 query.append(WHERE_LESSER_THAN);
2629 }
2630 }
2631 }
2632
2633 query.append(ORDER_BY_CLAUSE);
2634
2635 String[] orderByFields = orderByComparator.getOrderByFields();
2636
2637 for (int i = 0; i < orderByFields.length; i++) {
2638 if (getDB().isSupportsInlineDistinct()) {
2639 query.append(_ORDER_BY_ENTITY_ALIAS);
2640 }
2641 else {
2642 query.append(_ORDER_BY_ENTITY_TABLE);
2643 }
2644
2645 query.append(orderByFields[i]);
2646
2647 if ((i + 1) < orderByFields.length) {
2648 if (orderByComparator.isAscending() ^ previous) {
2649 query.append(ORDER_BY_ASC_HAS_NEXT);
2650 }
2651 else {
2652 query.append(ORDER_BY_DESC_HAS_NEXT);
2653 }
2654 }
2655 else {
2656 if (orderByComparator.isAscending() ^ previous) {
2657 query.append(ORDER_BY_ASC);
2658 }
2659 else {
2660 query.append(ORDER_BY_DESC);
2661 }
2662 }
2663 }
2664 }
2665
2666 else {
2667 if (getDB().isSupportsInlineDistinct()) {
2668 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
2669 }
2670 else {
2671 query.append(AnnouncementsEntryModelImpl.ORDER_BY_SQL);
2672 }
2673 }
2674
2675 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2676 AnnouncementsEntry.class.getName(),
2677 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
2678
2679 SQLQuery q = session.createSQLQuery(sql);
2680
2681 q.setFirstResult(0);
2682 q.setMaxResults(2);
2683
2684 if (getDB().isSupportsInlineDistinct()) {
2685 q.addEntity(_FILTER_ENTITY_ALIAS, AnnouncementsEntryImpl.class);
2686 }
2687 else {
2688 q.addEntity(_FILTER_ENTITY_TABLE, AnnouncementsEntryImpl.class);
2689 }
2690
2691 QueryPos qPos = QueryPos.getInstance(q);
2692
2693 qPos.add(classNameId);
2694
2695 qPos.add(classPK);
2696
2697 if (orderByComparator != null) {
2698 Object[] values = orderByComparator.getOrderByConditionValues(announcementsEntry);
2699
2700 for (Object value : values) {
2701 qPos.add(value);
2702 }
2703 }
2704
2705 List<AnnouncementsEntry> list = q.list();
2706
2707 if (list.size() == 2) {
2708 return list.get(1);
2709 }
2710 else {
2711 return null;
2712 }
2713 }
2714
2715
2724 public List<AnnouncementsEntry> findByC_C_A(long classNameId, long classPK,
2725 boolean alert) throws SystemException {
2726 return findByC_C_A(classNameId, classPK, alert, QueryUtil.ALL_POS,
2727 QueryUtil.ALL_POS, null);
2728 }
2729
2730
2745 public List<AnnouncementsEntry> findByC_C_A(long classNameId, long classPK,
2746 boolean alert, int start, int end) throws SystemException {
2747 return findByC_C_A(classNameId, classPK, alert, start, end, null);
2748 }
2749
2750
2766 public List<AnnouncementsEntry> findByC_C_A(long classNameId, long classPK,
2767 boolean alert, int start, int end, OrderByComparator orderByComparator)
2768 throws SystemException {
2769 FinderPath finderPath = null;
2770 Object[] finderArgs = null;
2771
2772 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
2773 (orderByComparator == null)) {
2774 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_BY_C_C_A;
2775 finderArgs = new Object[] { classNameId, classPK, alert };
2776 }
2777 else {
2778 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_BY_C_C_A;
2779 finderArgs = new Object[] {
2780 classNameId, classPK, alert,
2781
2782 start, end, orderByComparator
2783 };
2784 }
2785
2786 List<AnnouncementsEntry> list = (List<AnnouncementsEntry>)FinderCacheUtil.getResult(finderPath,
2787 finderArgs, this);
2788
2789 if ((list != null) && !list.isEmpty()) {
2790 for (AnnouncementsEntry announcementsEntry : list) {
2791 if ((classNameId != announcementsEntry.getClassNameId()) ||
2792 (classPK != announcementsEntry.getClassPK()) ||
2793 (alert != announcementsEntry.getAlert())) {
2794 list = null;
2795
2796 break;
2797 }
2798 }
2799 }
2800
2801 if (list == null) {
2802 StringBundler query = null;
2803
2804 if (orderByComparator != null) {
2805 query = new StringBundler(5 +
2806 (orderByComparator.getOrderByFields().length * 3));
2807 }
2808 else {
2809 query = new StringBundler(5);
2810 }
2811
2812 query.append(_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
2813
2814 query.append(_FINDER_COLUMN_C_C_A_CLASSNAMEID_2);
2815
2816 query.append(_FINDER_COLUMN_C_C_A_CLASSPK_2);
2817
2818 query.append(_FINDER_COLUMN_C_C_A_ALERT_2);
2819
2820 if (orderByComparator != null) {
2821 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2822 orderByComparator);
2823 }
2824
2825 else {
2826 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
2827 }
2828
2829 String sql = query.toString();
2830
2831 Session session = null;
2832
2833 try {
2834 session = openSession();
2835
2836 Query q = session.createQuery(sql);
2837
2838 QueryPos qPos = QueryPos.getInstance(q);
2839
2840 qPos.add(classNameId);
2841
2842 qPos.add(classPK);
2843
2844 qPos.add(alert);
2845
2846 list = (List<AnnouncementsEntry>)QueryUtil.list(q,
2847 getDialect(), start, end);
2848 }
2849 catch (Exception e) {
2850 throw processException(e);
2851 }
2852 finally {
2853 if (list == null) {
2854 FinderCacheUtil.removeResult(finderPath, finderArgs);
2855 }
2856 else {
2857 cacheResult(list);
2858
2859 FinderCacheUtil.putResult(finderPath, finderArgs, list);
2860 }
2861
2862 closeSession(session);
2863 }
2864 }
2865
2866 return list;
2867 }
2868
2869
2884 public AnnouncementsEntry findByC_C_A_First(long classNameId, long classPK,
2885 boolean alert, OrderByComparator orderByComparator)
2886 throws NoSuchEntryException, SystemException {
2887 List<AnnouncementsEntry> list = findByC_C_A(classNameId, classPK,
2888 alert, 0, 1, orderByComparator);
2889
2890 if (list.isEmpty()) {
2891 StringBundler msg = new StringBundler(8);
2892
2893 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2894
2895 msg.append("classNameId=");
2896 msg.append(classNameId);
2897
2898 msg.append(", classPK=");
2899 msg.append(classPK);
2900
2901 msg.append(", alert=");
2902 msg.append(alert);
2903
2904 msg.append(StringPool.CLOSE_CURLY_BRACE);
2905
2906 throw new NoSuchEntryException(msg.toString());
2907 }
2908 else {
2909 return list.get(0);
2910 }
2911 }
2912
2913
2928 public AnnouncementsEntry findByC_C_A_Last(long classNameId, long classPK,
2929 boolean alert, OrderByComparator orderByComparator)
2930 throws NoSuchEntryException, SystemException {
2931 int count = countByC_C_A(classNameId, classPK, alert);
2932
2933 List<AnnouncementsEntry> list = findByC_C_A(classNameId, classPK,
2934 alert, count - 1, count, orderByComparator);
2935
2936 if (list.isEmpty()) {
2937 StringBundler msg = new StringBundler(8);
2938
2939 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2940
2941 msg.append("classNameId=");
2942 msg.append(classNameId);
2943
2944 msg.append(", classPK=");
2945 msg.append(classPK);
2946
2947 msg.append(", alert=");
2948 msg.append(alert);
2949
2950 msg.append(StringPool.CLOSE_CURLY_BRACE);
2951
2952 throw new NoSuchEntryException(msg.toString());
2953 }
2954 else {
2955 return list.get(0);
2956 }
2957 }
2958
2959
2975 public AnnouncementsEntry[] findByC_C_A_PrevAndNext(long entryId,
2976 long classNameId, long classPK, boolean alert,
2977 OrderByComparator orderByComparator)
2978 throws NoSuchEntryException, SystemException {
2979 AnnouncementsEntry announcementsEntry = findByPrimaryKey(entryId);
2980
2981 Session session = null;
2982
2983 try {
2984 session = openSession();
2985
2986 AnnouncementsEntry[] array = new AnnouncementsEntryImpl[3];
2987
2988 array[0] = getByC_C_A_PrevAndNext(session, announcementsEntry,
2989 classNameId, classPK, alert, orderByComparator, true);
2990
2991 array[1] = announcementsEntry;
2992
2993 array[2] = getByC_C_A_PrevAndNext(session, announcementsEntry,
2994 classNameId, classPK, alert, orderByComparator, false);
2995
2996 return array;
2997 }
2998 catch (Exception e) {
2999 throw processException(e);
3000 }
3001 finally {
3002 closeSession(session);
3003 }
3004 }
3005
3006 protected AnnouncementsEntry getByC_C_A_PrevAndNext(Session session,
3007 AnnouncementsEntry announcementsEntry, long classNameId, long classPK,
3008 boolean alert, OrderByComparator orderByComparator, boolean previous) {
3009 StringBundler query = null;
3010
3011 if (orderByComparator != null) {
3012 query = new StringBundler(6 +
3013 (orderByComparator.getOrderByFields().length * 6));
3014 }
3015 else {
3016 query = new StringBundler(3);
3017 }
3018
3019 query.append(_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
3020
3021 query.append(_FINDER_COLUMN_C_C_A_CLASSNAMEID_2);
3022
3023 query.append(_FINDER_COLUMN_C_C_A_CLASSPK_2);
3024
3025 query.append(_FINDER_COLUMN_C_C_A_ALERT_2);
3026
3027 if (orderByComparator != null) {
3028 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
3029
3030 if (orderByConditionFields.length > 0) {
3031 query.append(WHERE_AND);
3032 }
3033
3034 for (int i = 0; i < orderByConditionFields.length; i++) {
3035 query.append(_ORDER_BY_ENTITY_ALIAS);
3036 query.append(orderByConditionFields[i]);
3037
3038 if ((i + 1) < orderByConditionFields.length) {
3039 if (orderByComparator.isAscending() ^ previous) {
3040 query.append(WHERE_GREATER_THAN_HAS_NEXT);
3041 }
3042 else {
3043 query.append(WHERE_LESSER_THAN_HAS_NEXT);
3044 }
3045 }
3046 else {
3047 if (orderByComparator.isAscending() ^ previous) {
3048 query.append(WHERE_GREATER_THAN);
3049 }
3050 else {
3051 query.append(WHERE_LESSER_THAN);
3052 }
3053 }
3054 }
3055
3056 query.append(ORDER_BY_CLAUSE);
3057
3058 String[] orderByFields = orderByComparator.getOrderByFields();
3059
3060 for (int i = 0; i < orderByFields.length; i++) {
3061 query.append(_ORDER_BY_ENTITY_ALIAS);
3062 query.append(orderByFields[i]);
3063
3064 if ((i + 1) < orderByFields.length) {
3065 if (orderByComparator.isAscending() ^ previous) {
3066 query.append(ORDER_BY_ASC_HAS_NEXT);
3067 }
3068 else {
3069 query.append(ORDER_BY_DESC_HAS_NEXT);
3070 }
3071 }
3072 else {
3073 if (orderByComparator.isAscending() ^ previous) {
3074 query.append(ORDER_BY_ASC);
3075 }
3076 else {
3077 query.append(ORDER_BY_DESC);
3078 }
3079 }
3080 }
3081 }
3082
3083 else {
3084 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
3085 }
3086
3087 String sql = query.toString();
3088
3089 Query q = session.createQuery(sql);
3090
3091 q.setFirstResult(0);
3092 q.setMaxResults(2);
3093
3094 QueryPos qPos = QueryPos.getInstance(q);
3095
3096 qPos.add(classNameId);
3097
3098 qPos.add(classPK);
3099
3100 qPos.add(alert);
3101
3102 if (orderByComparator != null) {
3103 Object[] values = orderByComparator.getOrderByConditionValues(announcementsEntry);
3104
3105 for (Object value : values) {
3106 qPos.add(value);
3107 }
3108 }
3109
3110 List<AnnouncementsEntry> list = q.list();
3111
3112 if (list.size() == 2) {
3113 return list.get(1);
3114 }
3115 else {
3116 return null;
3117 }
3118 }
3119
3120
3129 public List<AnnouncementsEntry> filterFindByC_C_A(long classNameId,
3130 long classPK, boolean alert) throws SystemException {
3131 return filterFindByC_C_A(classNameId, classPK, alert,
3132 QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
3133 }
3134
3135
3150 public List<AnnouncementsEntry> filterFindByC_C_A(long classNameId,
3151 long classPK, boolean alert, int start, int end)
3152 throws SystemException {
3153 return filterFindByC_C_A(classNameId, classPK, alert, start, end, null);
3154 }
3155
3156
3172 public List<AnnouncementsEntry> filterFindByC_C_A(long classNameId,
3173 long classPK, boolean alert, int start, int end,
3174 OrderByComparator orderByComparator) throws SystemException {
3175 if (!InlineSQLHelperUtil.isEnabled()) {
3176 return findByC_C_A(classNameId, classPK, alert, start, end,
3177 orderByComparator);
3178 }
3179
3180 StringBundler query = null;
3181
3182 if (orderByComparator != null) {
3183 query = new StringBundler(5 +
3184 (orderByComparator.getOrderByFields().length * 3));
3185 }
3186 else {
3187 query = new StringBundler(5);
3188 }
3189
3190 if (getDB().isSupportsInlineDistinct()) {
3191 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
3192 }
3193 else {
3194 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_1);
3195 }
3196
3197 query.append(_FINDER_COLUMN_C_C_A_CLASSNAMEID_2);
3198
3199 query.append(_FINDER_COLUMN_C_C_A_CLASSPK_2);
3200
3201 query.append(_FINDER_COLUMN_C_C_A_ALERT_2);
3202
3203 if (!getDB().isSupportsInlineDistinct()) {
3204 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_2);
3205 }
3206
3207 if (orderByComparator != null) {
3208 if (getDB().isSupportsInlineDistinct()) {
3209 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
3210 orderByComparator);
3211 }
3212 else {
3213 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
3214 orderByComparator);
3215 }
3216 }
3217
3218 else {
3219 if (getDB().isSupportsInlineDistinct()) {
3220 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
3221 }
3222 else {
3223 query.append(AnnouncementsEntryModelImpl.ORDER_BY_SQL);
3224 }
3225 }
3226
3227 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3228 AnnouncementsEntry.class.getName(),
3229 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
3230
3231 Session session = null;
3232
3233 try {
3234 session = openSession();
3235
3236 SQLQuery q = session.createSQLQuery(sql);
3237
3238 if (getDB().isSupportsInlineDistinct()) {
3239 q.addEntity(_FILTER_ENTITY_ALIAS, AnnouncementsEntryImpl.class);
3240 }
3241 else {
3242 q.addEntity(_FILTER_ENTITY_TABLE, AnnouncementsEntryImpl.class);
3243 }
3244
3245 QueryPos qPos = QueryPos.getInstance(q);
3246
3247 qPos.add(classNameId);
3248
3249 qPos.add(classPK);
3250
3251 qPos.add(alert);
3252
3253 return (List<AnnouncementsEntry>)QueryUtil.list(q, getDialect(),
3254 start, end);
3255 }
3256 catch (Exception e) {
3257 throw processException(e);
3258 }
3259 finally {
3260 closeSession(session);
3261 }
3262 }
3263
3264
3276 public AnnouncementsEntry[] filterFindByC_C_A_PrevAndNext(long entryId,
3277 long classNameId, long classPK, boolean alert,
3278 OrderByComparator orderByComparator)
3279 throws NoSuchEntryException, SystemException {
3280 if (!InlineSQLHelperUtil.isEnabled()) {
3281 return findByC_C_A_PrevAndNext(entryId, classNameId, classPK,
3282 alert, orderByComparator);
3283 }
3284
3285 AnnouncementsEntry announcementsEntry = findByPrimaryKey(entryId);
3286
3287 Session session = null;
3288
3289 try {
3290 session = openSession();
3291
3292 AnnouncementsEntry[] array = new AnnouncementsEntryImpl[3];
3293
3294 array[0] = filterGetByC_C_A_PrevAndNext(session,
3295 announcementsEntry, classNameId, classPK, alert,
3296 orderByComparator, true);
3297
3298 array[1] = announcementsEntry;
3299
3300 array[2] = filterGetByC_C_A_PrevAndNext(session,
3301 announcementsEntry, classNameId, classPK, alert,
3302 orderByComparator, false);
3303
3304 return array;
3305 }
3306 catch (Exception e) {
3307 throw processException(e);
3308 }
3309 finally {
3310 closeSession(session);
3311 }
3312 }
3313
3314 protected AnnouncementsEntry filterGetByC_C_A_PrevAndNext(Session session,
3315 AnnouncementsEntry announcementsEntry, long classNameId, long classPK,
3316 boolean alert, OrderByComparator orderByComparator, boolean previous) {
3317 StringBundler query = null;
3318
3319 if (orderByComparator != null) {
3320 query = new StringBundler(6 +
3321 (orderByComparator.getOrderByFields().length * 6));
3322 }
3323 else {
3324 query = new StringBundler(3);
3325 }
3326
3327 if (getDB().isSupportsInlineDistinct()) {
3328 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE);
3329 }
3330 else {
3331 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_1);
3332 }
3333
3334 query.append(_FINDER_COLUMN_C_C_A_CLASSNAMEID_2);
3335
3336 query.append(_FINDER_COLUMN_C_C_A_CLASSPK_2);
3337
3338 query.append(_FINDER_COLUMN_C_C_A_ALERT_2);
3339
3340 if (!getDB().isSupportsInlineDistinct()) {
3341 query.append(_FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_2);
3342 }
3343
3344 if (orderByComparator != null) {
3345 String[] orderByConditionFields = orderByComparator.getOrderByConditionFields();
3346
3347 if (orderByConditionFields.length > 0) {
3348 query.append(WHERE_AND);
3349 }
3350
3351 for (int i = 0; i < orderByConditionFields.length; i++) {
3352 if (getDB().isSupportsInlineDistinct()) {
3353 query.append(_ORDER_BY_ENTITY_ALIAS);
3354 }
3355 else {
3356 query.append(_ORDER_BY_ENTITY_TABLE);
3357 }
3358
3359 query.append(orderByConditionFields[i]);
3360
3361 if ((i + 1) < orderByConditionFields.length) {
3362 if (orderByComparator.isAscending() ^ previous) {
3363 query.append(WHERE_GREATER_THAN_HAS_NEXT);
3364 }
3365 else {
3366 query.append(WHERE_LESSER_THAN_HAS_NEXT);
3367 }
3368 }
3369 else {
3370 if (orderByComparator.isAscending() ^ previous) {
3371 query.append(WHERE_GREATER_THAN);
3372 }
3373 else {
3374 query.append(WHERE_LESSER_THAN);
3375 }
3376 }
3377 }
3378
3379 query.append(ORDER_BY_CLAUSE);
3380
3381 String[] orderByFields = orderByComparator.getOrderByFields();
3382
3383 for (int i = 0; i < orderByFields.length; i++) {
3384 if (getDB().isSupportsInlineDistinct()) {
3385 query.append(_ORDER_BY_ENTITY_ALIAS);
3386 }
3387 else {
3388 query.append(_ORDER_BY_ENTITY_TABLE);
3389 }
3390
3391 query.append(orderByFields[i]);
3392
3393 if ((i + 1) < orderByFields.length) {
3394 if (orderByComparator.isAscending() ^ previous) {
3395 query.append(ORDER_BY_ASC_HAS_NEXT);
3396 }
3397 else {
3398 query.append(ORDER_BY_DESC_HAS_NEXT);
3399 }
3400 }
3401 else {
3402 if (orderByComparator.isAscending() ^ previous) {
3403 query.append(ORDER_BY_ASC);
3404 }
3405 else {
3406 query.append(ORDER_BY_DESC);
3407 }
3408 }
3409 }
3410 }
3411
3412 else {
3413 if (getDB().isSupportsInlineDistinct()) {
3414 query.append(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
3415 }
3416 else {
3417 query.append(AnnouncementsEntryModelImpl.ORDER_BY_SQL);
3418 }
3419 }
3420
3421 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3422 AnnouncementsEntry.class.getName(),
3423 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
3424
3425 SQLQuery q = session.createSQLQuery(sql);
3426
3427 q.setFirstResult(0);
3428 q.setMaxResults(2);
3429
3430 if (getDB().isSupportsInlineDistinct()) {
3431 q.addEntity(_FILTER_ENTITY_ALIAS, AnnouncementsEntryImpl.class);
3432 }
3433 else {
3434 q.addEntity(_FILTER_ENTITY_TABLE, AnnouncementsEntryImpl.class);
3435 }
3436
3437 QueryPos qPos = QueryPos.getInstance(q);
3438
3439 qPos.add(classNameId);
3440
3441 qPos.add(classPK);
3442
3443 qPos.add(alert);
3444
3445 if (orderByComparator != null) {
3446 Object[] values = orderByComparator.getOrderByConditionValues(announcementsEntry);
3447
3448 for (Object value : values) {
3449 qPos.add(value);
3450 }
3451 }
3452
3453 List<AnnouncementsEntry> list = q.list();
3454
3455 if (list.size() == 2) {
3456 return list.get(1);
3457 }
3458 else {
3459 return null;
3460 }
3461 }
3462
3463
3469 public List<AnnouncementsEntry> findAll() throws SystemException {
3470 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
3471 }
3472
3473
3485 public List<AnnouncementsEntry> findAll(int start, int end)
3486 throws SystemException {
3487 return findAll(start, end, null);
3488 }
3489
3490
3503 public List<AnnouncementsEntry> findAll(int start, int end,
3504 OrderByComparator orderByComparator) throws SystemException {
3505 FinderPath finderPath = null;
3506 Object[] finderArgs = new Object[] { start, end, orderByComparator };
3507
3508 if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
3509 (orderByComparator == null)) {
3510 finderPath = FINDER_PATH_WITHOUT_PAGINATION_FIND_ALL;
3511 finderArgs = FINDER_ARGS_EMPTY;
3512 }
3513 else {
3514 finderPath = FINDER_PATH_WITH_PAGINATION_FIND_ALL;
3515 finderArgs = new Object[] { start, end, orderByComparator };
3516 }
3517
3518 List<AnnouncementsEntry> list = (List<AnnouncementsEntry>)FinderCacheUtil.getResult(finderPath,
3519 finderArgs, this);
3520
3521 if (list == null) {
3522 StringBundler query = null;
3523 String sql = null;
3524
3525 if (orderByComparator != null) {
3526 query = new StringBundler(2 +
3527 (orderByComparator.getOrderByFields().length * 3));
3528
3529 query.append(_SQL_SELECT_ANNOUNCEMENTSENTRY);
3530
3531 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
3532 orderByComparator);
3533
3534 sql = query.toString();
3535 }
3536 else {
3537 sql = _SQL_SELECT_ANNOUNCEMENTSENTRY.concat(AnnouncementsEntryModelImpl.ORDER_BY_JPQL);
3538 }
3539
3540 Session session = null;
3541
3542 try {
3543 session = openSession();
3544
3545 Query q = session.createQuery(sql);
3546
3547 if (orderByComparator == null) {
3548 list = (List<AnnouncementsEntry>)QueryUtil.list(q,
3549 getDialect(), start, end, false);
3550
3551 Collections.sort(list);
3552 }
3553 else {
3554 list = (List<AnnouncementsEntry>)QueryUtil.list(q,
3555 getDialect(), start, end);
3556 }
3557 }
3558 catch (Exception e) {
3559 throw processException(e);
3560 }
3561 finally {
3562 if (list == null) {
3563 FinderCacheUtil.removeResult(finderPath, finderArgs);
3564 }
3565 else {
3566 cacheResult(list);
3567
3568 FinderCacheUtil.putResult(finderPath, finderArgs, list);
3569 }
3570
3571 closeSession(session);
3572 }
3573 }
3574
3575 return list;
3576 }
3577
3578
3584 public void removeByUuid(String uuid) throws SystemException {
3585 for (AnnouncementsEntry announcementsEntry : findByUuid(uuid)) {
3586 remove(announcementsEntry);
3587 }
3588 }
3589
3590
3596 public void removeByUserId(long userId) throws SystemException {
3597 for (AnnouncementsEntry announcementsEntry : findByUserId(userId)) {
3598 remove(announcementsEntry);
3599 }
3600 }
3601
3602
3609 public void removeByC_C(long classNameId, long classPK)
3610 throws SystemException {
3611 for (AnnouncementsEntry announcementsEntry : findByC_C(classNameId,
3612 classPK)) {
3613 remove(announcementsEntry);
3614 }
3615 }
3616
3617
3625 public void removeByC_C_A(long classNameId, long classPK, boolean alert)
3626 throws SystemException {
3627 for (AnnouncementsEntry announcementsEntry : findByC_C_A(classNameId,
3628 classPK, alert)) {
3629 remove(announcementsEntry);
3630 }
3631 }
3632
3633
3638 public void removeAll() throws SystemException {
3639 for (AnnouncementsEntry announcementsEntry : findAll()) {
3640 remove(announcementsEntry);
3641 }
3642 }
3643
3644
3651 public int countByUuid(String uuid) throws SystemException {
3652 Object[] finderArgs = new Object[] { uuid };
3653
3654 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
3655 finderArgs, this);
3656
3657 if (count == null) {
3658 StringBundler query = new StringBundler(2);
3659
3660 query.append(_SQL_COUNT_ANNOUNCEMENTSENTRY_WHERE);
3661
3662 if (uuid == null) {
3663 query.append(_FINDER_COLUMN_UUID_UUID_1);
3664 }
3665 else {
3666 if (uuid.equals(StringPool.BLANK)) {
3667 query.append(_FINDER_COLUMN_UUID_UUID_3);
3668 }
3669 else {
3670 query.append(_FINDER_COLUMN_UUID_UUID_2);
3671 }
3672 }
3673
3674 String sql = query.toString();
3675
3676 Session session = null;
3677
3678 try {
3679 session = openSession();
3680
3681 Query q = session.createQuery(sql);
3682
3683 QueryPos qPos = QueryPos.getInstance(q);
3684
3685 if (uuid != null) {
3686 qPos.add(uuid);
3687 }
3688
3689 count = (Long)q.uniqueResult();
3690 }
3691 catch (Exception e) {
3692 throw processException(e);
3693 }
3694 finally {
3695 if (count == null) {
3696 count = Long.valueOf(0);
3697 }
3698
3699 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
3700 finderArgs, count);
3701
3702 closeSession(session);
3703 }
3704 }
3705
3706 return count.intValue();
3707 }
3708
3709
3716 public int filterCountByUuid(String uuid) throws SystemException {
3717 if (!InlineSQLHelperUtil.isEnabled()) {
3718 return countByUuid(uuid);
3719 }
3720
3721 StringBundler query = new StringBundler(2);
3722
3723 query.append(_FILTER_SQL_COUNT_ANNOUNCEMENTSENTRY_WHERE);
3724
3725 if (uuid == null) {
3726 query.append(_FINDER_COLUMN_UUID_UUID_1);
3727 }
3728 else {
3729 if (uuid.equals(StringPool.BLANK)) {
3730 query.append(_FINDER_COLUMN_UUID_UUID_3);
3731 }
3732 else {
3733 query.append(_FINDER_COLUMN_UUID_UUID_2);
3734 }
3735 }
3736
3737 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3738 AnnouncementsEntry.class.getName(),
3739 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
3740
3741 Session session = null;
3742
3743 try {
3744 session = openSession();
3745
3746 SQLQuery q = session.createSQLQuery(sql);
3747
3748 q.addScalar(COUNT_COLUMN_NAME,
3749 com.liferay.portal.kernel.dao.orm.Type.LONG);
3750
3751 QueryPos qPos = QueryPos.getInstance(q);
3752
3753 if (uuid != null) {
3754 qPos.add(uuid);
3755 }
3756
3757 Long count = (Long)q.uniqueResult();
3758
3759 return count.intValue();
3760 }
3761 catch (Exception e) {
3762 throw processException(e);
3763 }
3764 finally {
3765 closeSession(session);
3766 }
3767 }
3768
3769
3776 public int countByUserId(long userId) throws SystemException {
3777 Object[] finderArgs = new Object[] { userId };
3778
3779 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_USERID,
3780 finderArgs, this);
3781
3782 if (count == null) {
3783 StringBundler query = new StringBundler(2);
3784
3785 query.append(_SQL_COUNT_ANNOUNCEMENTSENTRY_WHERE);
3786
3787 query.append(_FINDER_COLUMN_USERID_USERID_2);
3788
3789 String sql = query.toString();
3790
3791 Session session = null;
3792
3793 try {
3794 session = openSession();
3795
3796 Query q = session.createQuery(sql);
3797
3798 QueryPos qPos = QueryPos.getInstance(q);
3799
3800 qPos.add(userId);
3801
3802 count = (Long)q.uniqueResult();
3803 }
3804 catch (Exception e) {
3805 throw processException(e);
3806 }
3807 finally {
3808 if (count == null) {
3809 count = Long.valueOf(0);
3810 }
3811
3812 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_USERID,
3813 finderArgs, count);
3814
3815 closeSession(session);
3816 }
3817 }
3818
3819 return count.intValue();
3820 }
3821
3822
3829 public int filterCountByUserId(long userId) throws SystemException {
3830 if (!InlineSQLHelperUtil.isEnabled()) {
3831 return countByUserId(userId);
3832 }
3833
3834 StringBundler query = new StringBundler(2);
3835
3836 query.append(_FILTER_SQL_COUNT_ANNOUNCEMENTSENTRY_WHERE);
3837
3838 query.append(_FINDER_COLUMN_USERID_USERID_2);
3839
3840 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3841 AnnouncementsEntry.class.getName(),
3842 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
3843
3844 Session session = null;
3845
3846 try {
3847 session = openSession();
3848
3849 SQLQuery q = session.createSQLQuery(sql);
3850
3851 q.addScalar(COUNT_COLUMN_NAME,
3852 com.liferay.portal.kernel.dao.orm.Type.LONG);
3853
3854 QueryPos qPos = QueryPos.getInstance(q);
3855
3856 qPos.add(userId);
3857
3858 Long count = (Long)q.uniqueResult();
3859
3860 return count.intValue();
3861 }
3862 catch (Exception e) {
3863 throw processException(e);
3864 }
3865 finally {
3866 closeSession(session);
3867 }
3868 }
3869
3870
3878 public int countByC_C(long classNameId, long classPK)
3879 throws SystemException {
3880 Object[] finderArgs = new Object[] { classNameId, classPK };
3881
3882 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C,
3883 finderArgs, this);
3884
3885 if (count == null) {
3886 StringBundler query = new StringBundler(3);
3887
3888 query.append(_SQL_COUNT_ANNOUNCEMENTSENTRY_WHERE);
3889
3890 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
3891
3892 query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
3893
3894 String sql = query.toString();
3895
3896 Session session = null;
3897
3898 try {
3899 session = openSession();
3900
3901 Query q = session.createQuery(sql);
3902
3903 QueryPos qPos = QueryPos.getInstance(q);
3904
3905 qPos.add(classNameId);
3906
3907 qPos.add(classPK);
3908
3909 count = (Long)q.uniqueResult();
3910 }
3911 catch (Exception e) {
3912 throw processException(e);
3913 }
3914 finally {
3915 if (count == null) {
3916 count = Long.valueOf(0);
3917 }
3918
3919 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C, finderArgs,
3920 count);
3921
3922 closeSession(session);
3923 }
3924 }
3925
3926 return count.intValue();
3927 }
3928
3929
3937 public int filterCountByC_C(long classNameId, long classPK)
3938 throws SystemException {
3939 if (!InlineSQLHelperUtil.isEnabled()) {
3940 return countByC_C(classNameId, classPK);
3941 }
3942
3943 StringBundler query = new StringBundler(3);
3944
3945 query.append(_FILTER_SQL_COUNT_ANNOUNCEMENTSENTRY_WHERE);
3946
3947 query.append(_FINDER_COLUMN_C_C_CLASSNAMEID_2);
3948
3949 query.append(_FINDER_COLUMN_C_C_CLASSPK_2);
3950
3951 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3952 AnnouncementsEntry.class.getName(),
3953 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
3954
3955 Session session = null;
3956
3957 try {
3958 session = openSession();
3959
3960 SQLQuery q = session.createSQLQuery(sql);
3961
3962 q.addScalar(COUNT_COLUMN_NAME,
3963 com.liferay.portal.kernel.dao.orm.Type.LONG);
3964
3965 QueryPos qPos = QueryPos.getInstance(q);
3966
3967 qPos.add(classNameId);
3968
3969 qPos.add(classPK);
3970
3971 Long count = (Long)q.uniqueResult();
3972
3973 return count.intValue();
3974 }
3975 catch (Exception e) {
3976 throw processException(e);
3977 }
3978 finally {
3979 closeSession(session);
3980 }
3981 }
3982
3983
3992 public int countByC_C_A(long classNameId, long classPK, boolean alert)
3993 throws SystemException {
3994 Object[] finderArgs = new Object[] { classNameId, classPK, alert };
3995
3996 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_C_C_A,
3997 finderArgs, this);
3998
3999 if (count == null) {
4000 StringBundler query = new StringBundler(4);
4001
4002 query.append(_SQL_COUNT_ANNOUNCEMENTSENTRY_WHERE);
4003
4004 query.append(_FINDER_COLUMN_C_C_A_CLASSNAMEID_2);
4005
4006 query.append(_FINDER_COLUMN_C_C_A_CLASSPK_2);
4007
4008 query.append(_FINDER_COLUMN_C_C_A_ALERT_2);
4009
4010 String sql = query.toString();
4011
4012 Session session = null;
4013
4014 try {
4015 session = openSession();
4016
4017 Query q = session.createQuery(sql);
4018
4019 QueryPos qPos = QueryPos.getInstance(q);
4020
4021 qPos.add(classNameId);
4022
4023 qPos.add(classPK);
4024
4025 qPos.add(alert);
4026
4027 count = (Long)q.uniqueResult();
4028 }
4029 catch (Exception e) {
4030 throw processException(e);
4031 }
4032 finally {
4033 if (count == null) {
4034 count = Long.valueOf(0);
4035 }
4036
4037 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_C_C_A,
4038 finderArgs, count);
4039
4040 closeSession(session);
4041 }
4042 }
4043
4044 return count.intValue();
4045 }
4046
4047
4056 public int filterCountByC_C_A(long classNameId, long classPK, boolean alert)
4057 throws SystemException {
4058 if (!InlineSQLHelperUtil.isEnabled()) {
4059 return countByC_C_A(classNameId, classPK, alert);
4060 }
4061
4062 StringBundler query = new StringBundler(4);
4063
4064 query.append(_FILTER_SQL_COUNT_ANNOUNCEMENTSENTRY_WHERE);
4065
4066 query.append(_FINDER_COLUMN_C_C_A_CLASSNAMEID_2);
4067
4068 query.append(_FINDER_COLUMN_C_C_A_CLASSPK_2);
4069
4070 query.append(_FINDER_COLUMN_C_C_A_ALERT_2);
4071
4072 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
4073 AnnouncementsEntry.class.getName(),
4074 _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
4075
4076 Session session = null;
4077
4078 try {
4079 session = openSession();
4080
4081 SQLQuery q = session.createSQLQuery(sql);
4082
4083 q.addScalar(COUNT_COLUMN_NAME,
4084 com.liferay.portal.kernel.dao.orm.Type.LONG);
4085
4086 QueryPos qPos = QueryPos.getInstance(q);
4087
4088 qPos.add(classNameId);
4089
4090 qPos.add(classPK);
4091
4092 qPos.add(alert);
4093
4094 Long count = (Long)q.uniqueResult();
4095
4096 return count.intValue();
4097 }
4098 catch (Exception e) {
4099 throw processException(e);
4100 }
4101 finally {
4102 closeSession(session);
4103 }
4104 }
4105
4106
4112 public int countAll() throws SystemException {
4113 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
4114 FINDER_ARGS_EMPTY, this);
4115
4116 if (count == null) {
4117 Session session = null;
4118
4119 try {
4120 session = openSession();
4121
4122 Query q = session.createQuery(_SQL_COUNT_ANNOUNCEMENTSENTRY);
4123
4124 count = (Long)q.uniqueResult();
4125 }
4126 catch (Exception e) {
4127 throw processException(e);
4128 }
4129 finally {
4130 if (count == null) {
4131 count = Long.valueOf(0);
4132 }
4133
4134 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL,
4135 FINDER_ARGS_EMPTY, count);
4136
4137 closeSession(session);
4138 }
4139 }
4140
4141 return count.intValue();
4142 }
4143
4144
4147 public void afterPropertiesSet() {
4148 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
4149 com.liferay.portal.util.PropsUtil.get(
4150 "value.object.listener.com.liferay.portlet.announcements.model.AnnouncementsEntry")));
4151
4152 if (listenerClassNames.length > 0) {
4153 try {
4154 List<ModelListener<AnnouncementsEntry>> listenersList = new ArrayList<ModelListener<AnnouncementsEntry>>();
4155
4156 for (String listenerClassName : listenerClassNames) {
4157 listenersList.add((ModelListener<AnnouncementsEntry>)InstanceFactory.newInstance(
4158 listenerClassName));
4159 }
4160
4161 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
4162 }
4163 catch (Exception e) {
4164 _log.error(e);
4165 }
4166 }
4167 }
4168
4169 public void destroy() {
4170 EntityCacheUtil.removeCache(AnnouncementsEntryImpl.class.getName());
4171 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
4172 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION);
4173 }
4174
4175 @BeanReference(type = AnnouncementsDeliveryPersistence.class)
4176 protected AnnouncementsDeliveryPersistence announcementsDeliveryPersistence;
4177 @BeanReference(type = AnnouncementsEntryPersistence.class)
4178 protected AnnouncementsEntryPersistence announcementsEntryPersistence;
4179 @BeanReference(type = AnnouncementsFlagPersistence.class)
4180 protected AnnouncementsFlagPersistence announcementsFlagPersistence;
4181 @BeanReference(type = CompanyPersistence.class)
4182 protected CompanyPersistence companyPersistence;
4183 @BeanReference(type = GroupPersistence.class)
4184 protected GroupPersistence groupPersistence;
4185 @BeanReference(type = OrganizationPersistence.class)
4186 protected OrganizationPersistence organizationPersistence;
4187 @BeanReference(type = ResourcePersistence.class)
4188 protected ResourcePersistence resourcePersistence;
4189 @BeanReference(type = RolePersistence.class)
4190 protected RolePersistence rolePersistence;
4191 @BeanReference(type = UserPersistence.class)
4192 protected UserPersistence userPersistence;
4193 @BeanReference(type = UserGroupPersistence.class)
4194 protected UserGroupPersistence userGroupPersistence;
4195 private static final String _SQL_SELECT_ANNOUNCEMENTSENTRY = "SELECT announcementsEntry FROM AnnouncementsEntry announcementsEntry";
4196 private static final String _SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE = "SELECT announcementsEntry FROM AnnouncementsEntry announcementsEntry WHERE ";
4197 private static final String _SQL_COUNT_ANNOUNCEMENTSENTRY = "SELECT COUNT(announcementsEntry) FROM AnnouncementsEntry announcementsEntry";
4198 private static final String _SQL_COUNT_ANNOUNCEMENTSENTRY_WHERE = "SELECT COUNT(announcementsEntry) FROM AnnouncementsEntry announcementsEntry WHERE ";
4199 private static final String _FINDER_COLUMN_UUID_UUID_1 = "announcementsEntry.uuid IS NULL";
4200 private static final String _FINDER_COLUMN_UUID_UUID_2 = "announcementsEntry.uuid = ?";
4201 private static final String _FINDER_COLUMN_UUID_UUID_3 = "(announcementsEntry.uuid IS NULL OR announcementsEntry.uuid = ?)";
4202 private static final String _FINDER_COLUMN_USERID_USERID_2 = "announcementsEntry.userId = ?";
4203 private static final String _FINDER_COLUMN_C_C_CLASSNAMEID_2 = "announcementsEntry.classNameId = ? AND ";
4204 private static final String _FINDER_COLUMN_C_C_CLASSPK_2 = "announcementsEntry.classPK = ?";
4205 private static final String _FINDER_COLUMN_C_C_A_CLASSNAMEID_2 = "announcementsEntry.classNameId = ? AND ";
4206 private static final String _FINDER_COLUMN_C_C_A_CLASSPK_2 = "announcementsEntry.classPK = ? AND ";
4207 private static final String _FINDER_COLUMN_C_C_A_ALERT_2 = "announcementsEntry.alert = ?";
4208 private static final String _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN = "announcementsEntry.entryId";
4209 private static final String _FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_WHERE = "SELECT DISTINCT {announcementsEntry.*} FROM AnnouncementsEntry announcementsEntry WHERE ";
4210 private static final String _FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_1 =
4211 "SELECT {AnnouncementsEntry.*} FROM (SELECT DISTINCT announcementsEntry.entryId FROM AnnouncementsEntry announcementsEntry WHERE ";
4212 private static final String _FILTER_SQL_SELECT_ANNOUNCEMENTSENTRY_NO_INLINE_DISTINCT_WHERE_2 =
4213 ") TEMP_TABLE INNER JOIN AnnouncementsEntry ON TEMP_TABLE.entryId = AnnouncementsEntry.entryId";
4214 private static final String _FILTER_SQL_COUNT_ANNOUNCEMENTSENTRY_WHERE = "SELECT COUNT(DISTINCT announcementsEntry.entryId) AS COUNT_VALUE FROM AnnouncementsEntry announcementsEntry WHERE ";
4215 private static final String _FILTER_ENTITY_ALIAS = "announcementsEntry";
4216 private static final String _FILTER_ENTITY_TABLE = "AnnouncementsEntry";
4217 private static final String _ORDER_BY_ENTITY_ALIAS = "announcementsEntry.";
4218 private static final String _ORDER_BY_ENTITY_TABLE = "AnnouncementsEntry.";
4219 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No AnnouncementsEntry exists with the primary key ";
4220 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No AnnouncementsEntry exists with the key {";
4221 private static final boolean _HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE = com.liferay.portal.util.PropsValues.HIBERNATE_CACHE_USE_SECOND_LEVEL_CACHE;
4222 private static Log _log = LogFactoryUtil.getLog(AnnouncementsEntryPersistenceImpl.class);
4223 private static AnnouncementsEntry _nullAnnouncementsEntry = new AnnouncementsEntryImpl() {
4224 @Override
4225 public Object clone() {
4226 return this;
4227 }
4228
4229 @Override
4230 public CacheModel<AnnouncementsEntry> toCacheModel() {
4231 return _nullAnnouncementsEntryCacheModel;
4232 }
4233 };
4234
4235 private static CacheModel<AnnouncementsEntry> _nullAnnouncementsEntryCacheModel =
4236 new CacheModel<AnnouncementsEntry>() {
4237 public AnnouncementsEntry toEntityModel() {
4238 return _nullAnnouncementsEntry;
4239 }
4240 };
4241 }