001
014
015 package com.liferay.portlet.bookmarks.service.persistence;
016
017 import com.liferay.portal.NoSuchModelException;
018 import com.liferay.portal.kernel.annotation.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.ModelListener;
040 import com.liferay.portal.security.permission.InlineSQLHelperUtil;
041 import com.liferay.portal.service.persistence.BatchSessionUtil;
042 import com.liferay.portal.service.persistence.ResourcePersistence;
043 import com.liferay.portal.service.persistence.UserPersistence;
044 import com.liferay.portal.service.persistence.impl.BasePersistenceImpl;
045
046 import com.liferay.portlet.asset.service.persistence.AssetEntryPersistence;
047 import com.liferay.portlet.asset.service.persistence.AssetTagPersistence;
048 import com.liferay.portlet.bookmarks.NoSuchEntryException;
049 import com.liferay.portlet.bookmarks.model.BookmarksEntry;
050 import com.liferay.portlet.bookmarks.model.impl.BookmarksEntryImpl;
051 import com.liferay.portlet.bookmarks.model.impl.BookmarksEntryModelImpl;
052 import com.liferay.portlet.expando.service.persistence.ExpandoValuePersistence;
053
054 import java.io.Serializable;
055
056 import java.util.ArrayList;
057 import java.util.Collections;
058 import java.util.List;
059
060
076 public class BookmarksEntryPersistenceImpl extends BasePersistenceImpl<BookmarksEntry>
077 implements BookmarksEntryPersistence {
078 public static final String FINDER_CLASS_NAME_ENTITY = BookmarksEntryImpl.class.getName();
079 public static final String FINDER_CLASS_NAME_LIST = FINDER_CLASS_NAME_ENTITY +
080 ".List";
081 public static final FinderPath FINDER_PATH_FIND_BY_UUID = new FinderPath(BookmarksEntryModelImpl.ENTITY_CACHE_ENABLED,
082 BookmarksEntryModelImpl.FINDER_CACHE_ENABLED,
083 FINDER_CLASS_NAME_LIST, "findByUuid",
084 new String[] {
085 String.class.getName(),
086
087 "java.lang.Integer", "java.lang.Integer",
088 "com.liferay.portal.kernel.util.OrderByComparator"
089 });
090 public static final FinderPath FINDER_PATH_COUNT_BY_UUID = new FinderPath(BookmarksEntryModelImpl.ENTITY_CACHE_ENABLED,
091 BookmarksEntryModelImpl.FINDER_CACHE_ENABLED,
092 FINDER_CLASS_NAME_LIST, "countByUuid",
093 new String[] { String.class.getName() });
094 public static final FinderPath FINDER_PATH_FETCH_BY_UUID_G = new FinderPath(BookmarksEntryModelImpl.ENTITY_CACHE_ENABLED,
095 BookmarksEntryModelImpl.FINDER_CACHE_ENABLED,
096 FINDER_CLASS_NAME_ENTITY, "fetchByUUID_G",
097 new String[] { String.class.getName(), Long.class.getName() });
098 public static final FinderPath FINDER_PATH_COUNT_BY_UUID_G = new FinderPath(BookmarksEntryModelImpl.ENTITY_CACHE_ENABLED,
099 BookmarksEntryModelImpl.FINDER_CACHE_ENABLED,
100 FINDER_CLASS_NAME_LIST, "countByUUID_G",
101 new String[] { String.class.getName(), Long.class.getName() });
102 public static final FinderPath FINDER_PATH_FIND_BY_GROUPID = new FinderPath(BookmarksEntryModelImpl.ENTITY_CACHE_ENABLED,
103 BookmarksEntryModelImpl.FINDER_CACHE_ENABLED,
104 FINDER_CLASS_NAME_LIST, "findByGroupId",
105 new String[] {
106 Long.class.getName(),
107
108 "java.lang.Integer", "java.lang.Integer",
109 "com.liferay.portal.kernel.util.OrderByComparator"
110 });
111 public static final FinderPath FINDER_PATH_COUNT_BY_GROUPID = new FinderPath(BookmarksEntryModelImpl.ENTITY_CACHE_ENABLED,
112 BookmarksEntryModelImpl.FINDER_CACHE_ENABLED,
113 FINDER_CLASS_NAME_LIST, "countByGroupId",
114 new String[] { Long.class.getName() });
115 public static final FinderPath FINDER_PATH_FIND_BY_G_U = new FinderPath(BookmarksEntryModelImpl.ENTITY_CACHE_ENABLED,
116 BookmarksEntryModelImpl.FINDER_CACHE_ENABLED,
117 FINDER_CLASS_NAME_LIST, "findByG_U",
118 new String[] {
119 Long.class.getName(), Long.class.getName(),
120
121 "java.lang.Integer", "java.lang.Integer",
122 "com.liferay.portal.kernel.util.OrderByComparator"
123 });
124 public static final FinderPath FINDER_PATH_COUNT_BY_G_U = new FinderPath(BookmarksEntryModelImpl.ENTITY_CACHE_ENABLED,
125 BookmarksEntryModelImpl.FINDER_CACHE_ENABLED,
126 FINDER_CLASS_NAME_LIST, "countByG_U",
127 new String[] { Long.class.getName(), Long.class.getName() });
128 public static final FinderPath FINDER_PATH_FIND_BY_G_F = new FinderPath(BookmarksEntryModelImpl.ENTITY_CACHE_ENABLED,
129 BookmarksEntryModelImpl.FINDER_CACHE_ENABLED,
130 FINDER_CLASS_NAME_LIST, "findByG_F",
131 new String[] {
132 Long.class.getName(), Long.class.getName(),
133
134 "java.lang.Integer", "java.lang.Integer",
135 "com.liferay.portal.kernel.util.OrderByComparator"
136 });
137 public static final FinderPath FINDER_PATH_COUNT_BY_G_F = new FinderPath(BookmarksEntryModelImpl.ENTITY_CACHE_ENABLED,
138 BookmarksEntryModelImpl.FINDER_CACHE_ENABLED,
139 FINDER_CLASS_NAME_LIST, "countByG_F",
140 new String[] { Long.class.getName(), Long.class.getName() });
141 public static final FinderPath FINDER_PATH_FIND_ALL = new FinderPath(BookmarksEntryModelImpl.ENTITY_CACHE_ENABLED,
142 BookmarksEntryModelImpl.FINDER_CACHE_ENABLED,
143 FINDER_CLASS_NAME_LIST, "findAll", new String[0]);
144 public static final FinderPath FINDER_PATH_COUNT_ALL = new FinderPath(BookmarksEntryModelImpl.ENTITY_CACHE_ENABLED,
145 BookmarksEntryModelImpl.FINDER_CACHE_ENABLED,
146 FINDER_CLASS_NAME_LIST, "countAll", new String[0]);
147
148
153 public void cacheResult(BookmarksEntry bookmarksEntry) {
154 EntityCacheUtil.putResult(BookmarksEntryModelImpl.ENTITY_CACHE_ENABLED,
155 BookmarksEntryImpl.class, bookmarksEntry.getPrimaryKey(),
156 bookmarksEntry);
157
158 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
159 new Object[] {
160 bookmarksEntry.getUuid(), new Long(bookmarksEntry.getGroupId())
161 }, bookmarksEntry);
162 }
163
164
169 public void cacheResult(List<BookmarksEntry> bookmarksEntries) {
170 for (BookmarksEntry bookmarksEntry : bookmarksEntries) {
171 if (EntityCacheUtil.getResult(
172 BookmarksEntryModelImpl.ENTITY_CACHE_ENABLED,
173 BookmarksEntryImpl.class,
174 bookmarksEntry.getPrimaryKey(), this) == null) {
175 cacheResult(bookmarksEntry);
176 }
177 }
178 }
179
180
187 public void clearCache() {
188 CacheRegistryUtil.clear(BookmarksEntryImpl.class.getName());
189 EntityCacheUtil.clearCache(BookmarksEntryImpl.class.getName());
190 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_ENTITY);
191 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
192 }
193
194
201 public void clearCache(BookmarksEntry bookmarksEntry) {
202 EntityCacheUtil.removeResult(BookmarksEntryModelImpl.ENTITY_CACHE_ENABLED,
203 BookmarksEntryImpl.class, bookmarksEntry.getPrimaryKey());
204
205 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
206 new Object[] {
207 bookmarksEntry.getUuid(), new Long(bookmarksEntry.getGroupId())
208 });
209 }
210
211
217 public BookmarksEntry create(long entryId) {
218 BookmarksEntry bookmarksEntry = new BookmarksEntryImpl();
219
220 bookmarksEntry.setNew(true);
221 bookmarksEntry.setPrimaryKey(entryId);
222
223 String uuid = PortalUUIDUtil.generate();
224
225 bookmarksEntry.setUuid(uuid);
226
227 return bookmarksEntry;
228 }
229
230
238 public BookmarksEntry remove(Serializable primaryKey)
239 throws NoSuchModelException, SystemException {
240 return remove(((Long)primaryKey).longValue());
241 }
242
243
251 public BookmarksEntry remove(long entryId)
252 throws NoSuchEntryException, SystemException {
253 Session session = null;
254
255 try {
256 session = openSession();
257
258 BookmarksEntry bookmarksEntry = (BookmarksEntry)session.get(BookmarksEntryImpl.class,
259 new Long(entryId));
260
261 if (bookmarksEntry == null) {
262 if (_log.isWarnEnabled()) {
263 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + entryId);
264 }
265
266 throw new NoSuchEntryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
267 entryId);
268 }
269
270 return remove(bookmarksEntry);
271 }
272 catch (NoSuchEntryException nsee) {
273 throw nsee;
274 }
275 catch (Exception e) {
276 throw processException(e);
277 }
278 finally {
279 closeSession(session);
280 }
281 }
282
283 protected BookmarksEntry removeImpl(BookmarksEntry bookmarksEntry)
284 throws SystemException {
285 bookmarksEntry = toUnwrappedModel(bookmarksEntry);
286
287 Session session = null;
288
289 try {
290 session = openSession();
291
292 BatchSessionUtil.delete(session, bookmarksEntry);
293 }
294 catch (Exception e) {
295 throw processException(e);
296 }
297 finally {
298 closeSession(session);
299 }
300
301 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
302
303 BookmarksEntryModelImpl bookmarksEntryModelImpl = (BookmarksEntryModelImpl)bookmarksEntry;
304
305 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
306 new Object[] {
307 bookmarksEntryModelImpl.getUuid(),
308 new Long(bookmarksEntryModelImpl.getGroupId())
309 });
310
311 EntityCacheUtil.removeResult(BookmarksEntryModelImpl.ENTITY_CACHE_ENABLED,
312 BookmarksEntryImpl.class, bookmarksEntry.getPrimaryKey());
313
314 return bookmarksEntry;
315 }
316
317 public BookmarksEntry updateImpl(
318 com.liferay.portlet.bookmarks.model.BookmarksEntry bookmarksEntry,
319 boolean merge) throws SystemException {
320 bookmarksEntry = toUnwrappedModel(bookmarksEntry);
321
322 boolean isNew = bookmarksEntry.isNew();
323
324 BookmarksEntryModelImpl bookmarksEntryModelImpl = (BookmarksEntryModelImpl)bookmarksEntry;
325
326 if (Validator.isNull(bookmarksEntry.getUuid())) {
327 String uuid = PortalUUIDUtil.generate();
328
329 bookmarksEntry.setUuid(uuid);
330 }
331
332 Session session = null;
333
334 try {
335 session = openSession();
336
337 BatchSessionUtil.update(session, bookmarksEntry, merge);
338
339 bookmarksEntry.setNew(false);
340 }
341 catch (Exception e) {
342 throw processException(e);
343 }
344 finally {
345 closeSession(session);
346 }
347
348 FinderCacheUtil.clearCache(FINDER_CLASS_NAME_LIST);
349
350 EntityCacheUtil.putResult(BookmarksEntryModelImpl.ENTITY_CACHE_ENABLED,
351 BookmarksEntryImpl.class, bookmarksEntry.getPrimaryKey(),
352 bookmarksEntry);
353
354 if (!isNew &&
355 (!Validator.equals(bookmarksEntry.getUuid(),
356 bookmarksEntryModelImpl.getOriginalUuid()) ||
357 (bookmarksEntry.getGroupId() != bookmarksEntryModelImpl.getOriginalGroupId()))) {
358 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
359 new Object[] {
360 bookmarksEntryModelImpl.getOriginalUuid(),
361 new Long(bookmarksEntryModelImpl.getOriginalGroupId())
362 });
363 }
364
365 if (isNew ||
366 (!Validator.equals(bookmarksEntry.getUuid(),
367 bookmarksEntryModelImpl.getOriginalUuid()) ||
368 (bookmarksEntry.getGroupId() != bookmarksEntryModelImpl.getOriginalGroupId()))) {
369 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
370 new Object[] {
371 bookmarksEntry.getUuid(),
372 new Long(bookmarksEntry.getGroupId())
373 }, bookmarksEntry);
374 }
375
376 return bookmarksEntry;
377 }
378
379 protected BookmarksEntry toUnwrappedModel(BookmarksEntry bookmarksEntry) {
380 if (bookmarksEntry instanceof BookmarksEntryImpl) {
381 return bookmarksEntry;
382 }
383
384 BookmarksEntryImpl bookmarksEntryImpl = new BookmarksEntryImpl();
385
386 bookmarksEntryImpl.setNew(bookmarksEntry.isNew());
387 bookmarksEntryImpl.setPrimaryKey(bookmarksEntry.getPrimaryKey());
388
389 bookmarksEntryImpl.setUuid(bookmarksEntry.getUuid());
390 bookmarksEntryImpl.setEntryId(bookmarksEntry.getEntryId());
391 bookmarksEntryImpl.setGroupId(bookmarksEntry.getGroupId());
392 bookmarksEntryImpl.setCompanyId(bookmarksEntry.getCompanyId());
393 bookmarksEntryImpl.setUserId(bookmarksEntry.getUserId());
394 bookmarksEntryImpl.setCreateDate(bookmarksEntry.getCreateDate());
395 bookmarksEntryImpl.setModifiedDate(bookmarksEntry.getModifiedDate());
396 bookmarksEntryImpl.setFolderId(bookmarksEntry.getFolderId());
397 bookmarksEntryImpl.setName(bookmarksEntry.getName());
398 bookmarksEntryImpl.setUrl(bookmarksEntry.getUrl());
399 bookmarksEntryImpl.setComments(bookmarksEntry.getComments());
400 bookmarksEntryImpl.setVisits(bookmarksEntry.getVisits());
401 bookmarksEntryImpl.setPriority(bookmarksEntry.getPriority());
402
403 return bookmarksEntryImpl;
404 }
405
406
414 public BookmarksEntry findByPrimaryKey(Serializable primaryKey)
415 throws NoSuchModelException, SystemException {
416 return findByPrimaryKey(((Long)primaryKey).longValue());
417 }
418
419
427 public BookmarksEntry findByPrimaryKey(long entryId)
428 throws NoSuchEntryException, SystemException {
429 BookmarksEntry bookmarksEntry = fetchByPrimaryKey(entryId);
430
431 if (bookmarksEntry == null) {
432 if (_log.isWarnEnabled()) {
433 _log.warn(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + entryId);
434 }
435
436 throw new NoSuchEntryException(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY +
437 entryId);
438 }
439
440 return bookmarksEntry;
441 }
442
443
450 public BookmarksEntry fetchByPrimaryKey(Serializable primaryKey)
451 throws SystemException {
452 return fetchByPrimaryKey(((Long)primaryKey).longValue());
453 }
454
455
462 public BookmarksEntry fetchByPrimaryKey(long entryId)
463 throws SystemException {
464 BookmarksEntry bookmarksEntry = (BookmarksEntry)EntityCacheUtil.getResult(BookmarksEntryModelImpl.ENTITY_CACHE_ENABLED,
465 BookmarksEntryImpl.class, entryId, this);
466
467 if (bookmarksEntry == null) {
468 Session session = null;
469
470 try {
471 session = openSession();
472
473 bookmarksEntry = (BookmarksEntry)session.get(BookmarksEntryImpl.class,
474 new Long(entryId));
475 }
476 catch (Exception e) {
477 throw processException(e);
478 }
479 finally {
480 if (bookmarksEntry != null) {
481 cacheResult(bookmarksEntry);
482 }
483
484 closeSession(session);
485 }
486 }
487
488 return bookmarksEntry;
489 }
490
491
498 public List<BookmarksEntry> findByUuid(String uuid)
499 throws SystemException {
500 return findByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
501 }
502
503
516 public List<BookmarksEntry> findByUuid(String uuid, int start, int end)
517 throws SystemException {
518 return findByUuid(uuid, start, end, null);
519 }
520
521
535 public List<BookmarksEntry> findByUuid(String uuid, int start, int end,
536 OrderByComparator orderByComparator) throws SystemException {
537 Object[] finderArgs = new Object[] {
538 uuid,
539
540 String.valueOf(start), String.valueOf(end),
541 String.valueOf(orderByComparator)
542 };
543
544 List<BookmarksEntry> list = (List<BookmarksEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_UUID,
545 finderArgs, this);
546
547 if (list == null) {
548 StringBundler query = null;
549
550 if (orderByComparator != null) {
551 query = new StringBundler(3 +
552 (orderByComparator.getOrderByFields().length * 3));
553 }
554 else {
555 query = new StringBundler(3);
556 }
557
558 query.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE);
559
560 if (uuid == null) {
561 query.append(_FINDER_COLUMN_UUID_UUID_1);
562 }
563 else {
564 if (uuid.equals(StringPool.BLANK)) {
565 query.append(_FINDER_COLUMN_UUID_UUID_3);
566 }
567 else {
568 query.append(_FINDER_COLUMN_UUID_UUID_2);
569 }
570 }
571
572 if (orderByComparator != null) {
573 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
574 orderByComparator);
575 }
576
577 else {
578 query.append(BookmarksEntryModelImpl.ORDER_BY_JPQL);
579 }
580
581 String sql = query.toString();
582
583 Session session = null;
584
585 try {
586 session = openSession();
587
588 Query q = session.createQuery(sql);
589
590 QueryPos qPos = QueryPos.getInstance(q);
591
592 if (uuid != null) {
593 qPos.add(uuid);
594 }
595
596 list = (List<BookmarksEntry>)QueryUtil.list(q, getDialect(),
597 start, end);
598 }
599 catch (Exception e) {
600 throw processException(e);
601 }
602 finally {
603 if (list == null) {
604 FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_UUID,
605 finderArgs);
606 }
607 else {
608 cacheResult(list);
609
610 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_UUID,
611 finderArgs, list);
612 }
613
614 closeSession(session);
615 }
616 }
617
618 return list;
619 }
620
621
634 public BookmarksEntry findByUuid_First(String uuid,
635 OrderByComparator orderByComparator)
636 throws NoSuchEntryException, SystemException {
637 List<BookmarksEntry> list = findByUuid(uuid, 0, 1, orderByComparator);
638
639 if (list.isEmpty()) {
640 StringBundler msg = new StringBundler(4);
641
642 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
643
644 msg.append("uuid=");
645 msg.append(uuid);
646
647 msg.append(StringPool.CLOSE_CURLY_BRACE);
648
649 throw new NoSuchEntryException(msg.toString());
650 }
651 else {
652 return list.get(0);
653 }
654 }
655
656
669 public BookmarksEntry findByUuid_Last(String uuid,
670 OrderByComparator orderByComparator)
671 throws NoSuchEntryException, SystemException {
672 int count = countByUuid(uuid);
673
674 List<BookmarksEntry> list = findByUuid(uuid, count - 1, count,
675 orderByComparator);
676
677 if (list.isEmpty()) {
678 StringBundler msg = new StringBundler(4);
679
680 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
681
682 msg.append("uuid=");
683 msg.append(uuid);
684
685 msg.append(StringPool.CLOSE_CURLY_BRACE);
686
687 throw new NoSuchEntryException(msg.toString());
688 }
689 else {
690 return list.get(0);
691 }
692 }
693
694
708 public BookmarksEntry[] findByUuid_PrevAndNext(long entryId, String uuid,
709 OrderByComparator orderByComparator)
710 throws NoSuchEntryException, SystemException {
711 BookmarksEntry bookmarksEntry = findByPrimaryKey(entryId);
712
713 Session session = null;
714
715 try {
716 session = openSession();
717
718 BookmarksEntry[] array = new BookmarksEntryImpl[3];
719
720 array[0] = getByUuid_PrevAndNext(session, bookmarksEntry, uuid,
721 orderByComparator, true);
722
723 array[1] = bookmarksEntry;
724
725 array[2] = getByUuid_PrevAndNext(session, bookmarksEntry, uuid,
726 orderByComparator, false);
727
728 return array;
729 }
730 catch (Exception e) {
731 throw processException(e);
732 }
733 finally {
734 closeSession(session);
735 }
736 }
737
738 protected BookmarksEntry getByUuid_PrevAndNext(Session session,
739 BookmarksEntry bookmarksEntry, String uuid,
740 OrderByComparator orderByComparator, boolean previous) {
741 StringBundler query = null;
742
743 if (orderByComparator != null) {
744 query = new StringBundler(6 +
745 (orderByComparator.getOrderByFields().length * 6));
746 }
747 else {
748 query = new StringBundler(3);
749 }
750
751 query.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE);
752
753 if (uuid == null) {
754 query.append(_FINDER_COLUMN_UUID_UUID_1);
755 }
756 else {
757 if (uuid.equals(StringPool.BLANK)) {
758 query.append(_FINDER_COLUMN_UUID_UUID_3);
759 }
760 else {
761 query.append(_FINDER_COLUMN_UUID_UUID_2);
762 }
763 }
764
765 if (orderByComparator != null) {
766 String[] orderByFields = orderByComparator.getOrderByFields();
767
768 if (orderByFields.length > 0) {
769 query.append(WHERE_AND);
770 }
771
772 for (int i = 0; i < orderByFields.length; i++) {
773 query.append(_ORDER_BY_ENTITY_ALIAS);
774 query.append(orderByFields[i]);
775
776 if ((i + 1) < orderByFields.length) {
777 if (orderByComparator.isAscending() ^ previous) {
778 query.append(WHERE_GREATER_THAN_HAS_NEXT);
779 }
780 else {
781 query.append(WHERE_LESSER_THAN_HAS_NEXT);
782 }
783 }
784 else {
785 if (orderByComparator.isAscending() ^ previous) {
786 query.append(WHERE_GREATER_THAN);
787 }
788 else {
789 query.append(WHERE_LESSER_THAN);
790 }
791 }
792 }
793
794 query.append(ORDER_BY_CLAUSE);
795
796 for (int i = 0; i < orderByFields.length; i++) {
797 query.append(_ORDER_BY_ENTITY_ALIAS);
798 query.append(orderByFields[i]);
799
800 if ((i + 1) < orderByFields.length) {
801 if (orderByComparator.isAscending() ^ previous) {
802 query.append(ORDER_BY_ASC_HAS_NEXT);
803 }
804 else {
805 query.append(ORDER_BY_DESC_HAS_NEXT);
806 }
807 }
808 else {
809 if (orderByComparator.isAscending() ^ previous) {
810 query.append(ORDER_BY_ASC);
811 }
812 else {
813 query.append(ORDER_BY_DESC);
814 }
815 }
816 }
817 }
818
819 else {
820 query.append(BookmarksEntryModelImpl.ORDER_BY_JPQL);
821 }
822
823 String sql = query.toString();
824
825 Query q = session.createQuery(sql);
826
827 q.setFirstResult(0);
828 q.setMaxResults(2);
829
830 QueryPos qPos = QueryPos.getInstance(q);
831
832 if (uuid != null) {
833 qPos.add(uuid);
834 }
835
836 if (orderByComparator != null) {
837 Object[] values = orderByComparator.getOrderByValues(bookmarksEntry);
838
839 for (Object value : values) {
840 qPos.add(value);
841 }
842 }
843
844 List<BookmarksEntry> list = q.list();
845
846 if (list.size() == 2) {
847 return list.get(1);
848 }
849 else {
850 return null;
851 }
852 }
853
854
863 public BookmarksEntry findByUUID_G(String uuid, long groupId)
864 throws NoSuchEntryException, SystemException {
865 BookmarksEntry bookmarksEntry = fetchByUUID_G(uuid, groupId);
866
867 if (bookmarksEntry == null) {
868 StringBundler msg = new StringBundler(6);
869
870 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
871
872 msg.append("uuid=");
873 msg.append(uuid);
874
875 msg.append(", groupId=");
876 msg.append(groupId);
877
878 msg.append(StringPool.CLOSE_CURLY_BRACE);
879
880 if (_log.isWarnEnabled()) {
881 _log.warn(msg.toString());
882 }
883
884 throw new NoSuchEntryException(msg.toString());
885 }
886
887 return bookmarksEntry;
888 }
889
890
898 public BookmarksEntry fetchByUUID_G(String uuid, long groupId)
899 throws SystemException {
900 return fetchByUUID_G(uuid, groupId, true);
901 }
902
903
911 public BookmarksEntry fetchByUUID_G(String uuid, long groupId,
912 boolean retrieveFromCache) throws SystemException {
913 Object[] finderArgs = new Object[] { uuid, groupId };
914
915 Object result = null;
916
917 if (retrieveFromCache) {
918 result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_UUID_G,
919 finderArgs, this);
920 }
921
922 if (result == null) {
923 StringBundler query = new StringBundler(4);
924
925 query.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE);
926
927 if (uuid == null) {
928 query.append(_FINDER_COLUMN_UUID_G_UUID_1);
929 }
930 else {
931 if (uuid.equals(StringPool.BLANK)) {
932 query.append(_FINDER_COLUMN_UUID_G_UUID_3);
933 }
934 else {
935 query.append(_FINDER_COLUMN_UUID_G_UUID_2);
936 }
937 }
938
939 query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
940
941 query.append(BookmarksEntryModelImpl.ORDER_BY_JPQL);
942
943 String sql = query.toString();
944
945 Session session = null;
946
947 try {
948 session = openSession();
949
950 Query q = session.createQuery(sql);
951
952 QueryPos qPos = QueryPos.getInstance(q);
953
954 if (uuid != null) {
955 qPos.add(uuid);
956 }
957
958 qPos.add(groupId);
959
960 List<BookmarksEntry> list = q.list();
961
962 result = list;
963
964 BookmarksEntry bookmarksEntry = null;
965
966 if (list.isEmpty()) {
967 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
968 finderArgs, list);
969 }
970 else {
971 bookmarksEntry = list.get(0);
972
973 cacheResult(bookmarksEntry);
974
975 if ((bookmarksEntry.getUuid() == null) ||
976 !bookmarksEntry.getUuid().equals(uuid) ||
977 (bookmarksEntry.getGroupId() != groupId)) {
978 FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
979 finderArgs, bookmarksEntry);
980 }
981 }
982
983 return bookmarksEntry;
984 }
985 catch (Exception e) {
986 throw processException(e);
987 }
988 finally {
989 if (result == null) {
990 FinderCacheUtil.removeResult(FINDER_PATH_FETCH_BY_UUID_G,
991 finderArgs);
992 }
993
994 closeSession(session);
995 }
996 }
997 else {
998 if (result instanceof List<?>) {
999 return null;
1000 }
1001 else {
1002 return (BookmarksEntry)result;
1003 }
1004 }
1005 }
1006
1007
1014 public List<BookmarksEntry> findByGroupId(long groupId)
1015 throws SystemException {
1016 return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1017 }
1018
1019
1032 public List<BookmarksEntry> findByGroupId(long groupId, int start, int end)
1033 throws SystemException {
1034 return findByGroupId(groupId, start, end, null);
1035 }
1036
1037
1051 public List<BookmarksEntry> findByGroupId(long groupId, int start, int end,
1052 OrderByComparator orderByComparator) throws SystemException {
1053 Object[] finderArgs = new Object[] {
1054 groupId,
1055
1056 String.valueOf(start), String.valueOf(end),
1057 String.valueOf(orderByComparator)
1058 };
1059
1060 List<BookmarksEntry> list = (List<BookmarksEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_GROUPID,
1061 finderArgs, this);
1062
1063 if (list == null) {
1064 StringBundler query = null;
1065
1066 if (orderByComparator != null) {
1067 query = new StringBundler(3 +
1068 (orderByComparator.getOrderByFields().length * 3));
1069 }
1070 else {
1071 query = new StringBundler(3);
1072 }
1073
1074 query.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE);
1075
1076 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1077
1078 if (orderByComparator != null) {
1079 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1080 orderByComparator);
1081 }
1082
1083 else {
1084 query.append(BookmarksEntryModelImpl.ORDER_BY_JPQL);
1085 }
1086
1087 String sql = query.toString();
1088
1089 Session session = null;
1090
1091 try {
1092 session = openSession();
1093
1094 Query q = session.createQuery(sql);
1095
1096 QueryPos qPos = QueryPos.getInstance(q);
1097
1098 qPos.add(groupId);
1099
1100 list = (List<BookmarksEntry>)QueryUtil.list(q, getDialect(),
1101 start, end);
1102 }
1103 catch (Exception e) {
1104 throw processException(e);
1105 }
1106 finally {
1107 if (list == null) {
1108 FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_GROUPID,
1109 finderArgs);
1110 }
1111 else {
1112 cacheResult(list);
1113
1114 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_GROUPID,
1115 finderArgs, list);
1116 }
1117
1118 closeSession(session);
1119 }
1120 }
1121
1122 return list;
1123 }
1124
1125
1138 public BookmarksEntry findByGroupId_First(long groupId,
1139 OrderByComparator orderByComparator)
1140 throws NoSuchEntryException, SystemException {
1141 List<BookmarksEntry> list = findByGroupId(groupId, 0, 1,
1142 orderByComparator);
1143
1144 if (list.isEmpty()) {
1145 StringBundler msg = new StringBundler(4);
1146
1147 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1148
1149 msg.append("groupId=");
1150 msg.append(groupId);
1151
1152 msg.append(StringPool.CLOSE_CURLY_BRACE);
1153
1154 throw new NoSuchEntryException(msg.toString());
1155 }
1156 else {
1157 return list.get(0);
1158 }
1159 }
1160
1161
1174 public BookmarksEntry findByGroupId_Last(long groupId,
1175 OrderByComparator orderByComparator)
1176 throws NoSuchEntryException, SystemException {
1177 int count = countByGroupId(groupId);
1178
1179 List<BookmarksEntry> list = findByGroupId(groupId, count - 1, count,
1180 orderByComparator);
1181
1182 if (list.isEmpty()) {
1183 StringBundler msg = new StringBundler(4);
1184
1185 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1186
1187 msg.append("groupId=");
1188 msg.append(groupId);
1189
1190 msg.append(StringPool.CLOSE_CURLY_BRACE);
1191
1192 throw new NoSuchEntryException(msg.toString());
1193 }
1194 else {
1195 return list.get(0);
1196 }
1197 }
1198
1199
1213 public BookmarksEntry[] findByGroupId_PrevAndNext(long entryId,
1214 long groupId, OrderByComparator orderByComparator)
1215 throws NoSuchEntryException, SystemException {
1216 BookmarksEntry bookmarksEntry = findByPrimaryKey(entryId);
1217
1218 Session session = null;
1219
1220 try {
1221 session = openSession();
1222
1223 BookmarksEntry[] array = new BookmarksEntryImpl[3];
1224
1225 array[0] = getByGroupId_PrevAndNext(session, bookmarksEntry,
1226 groupId, orderByComparator, true);
1227
1228 array[1] = bookmarksEntry;
1229
1230 array[2] = getByGroupId_PrevAndNext(session, bookmarksEntry,
1231 groupId, orderByComparator, false);
1232
1233 return array;
1234 }
1235 catch (Exception e) {
1236 throw processException(e);
1237 }
1238 finally {
1239 closeSession(session);
1240 }
1241 }
1242
1243 protected BookmarksEntry getByGroupId_PrevAndNext(Session session,
1244 BookmarksEntry bookmarksEntry, long groupId,
1245 OrderByComparator orderByComparator, boolean previous) {
1246 StringBundler query = null;
1247
1248 if (orderByComparator != null) {
1249 query = new StringBundler(6 +
1250 (orderByComparator.getOrderByFields().length * 6));
1251 }
1252 else {
1253 query = new StringBundler(3);
1254 }
1255
1256 query.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE);
1257
1258 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1259
1260 if (orderByComparator != null) {
1261 String[] orderByFields = orderByComparator.getOrderByFields();
1262
1263 if (orderByFields.length > 0) {
1264 query.append(WHERE_AND);
1265 }
1266
1267 for (int i = 0; i < orderByFields.length; i++) {
1268 query.append(_ORDER_BY_ENTITY_ALIAS);
1269 query.append(orderByFields[i]);
1270
1271 if ((i + 1) < orderByFields.length) {
1272 if (orderByComparator.isAscending() ^ previous) {
1273 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1274 }
1275 else {
1276 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1277 }
1278 }
1279 else {
1280 if (orderByComparator.isAscending() ^ previous) {
1281 query.append(WHERE_GREATER_THAN);
1282 }
1283 else {
1284 query.append(WHERE_LESSER_THAN);
1285 }
1286 }
1287 }
1288
1289 query.append(ORDER_BY_CLAUSE);
1290
1291 for (int i = 0; i < orderByFields.length; i++) {
1292 query.append(_ORDER_BY_ENTITY_ALIAS);
1293 query.append(orderByFields[i]);
1294
1295 if ((i + 1) < orderByFields.length) {
1296 if (orderByComparator.isAscending() ^ previous) {
1297 query.append(ORDER_BY_ASC_HAS_NEXT);
1298 }
1299 else {
1300 query.append(ORDER_BY_DESC_HAS_NEXT);
1301 }
1302 }
1303 else {
1304 if (orderByComparator.isAscending() ^ previous) {
1305 query.append(ORDER_BY_ASC);
1306 }
1307 else {
1308 query.append(ORDER_BY_DESC);
1309 }
1310 }
1311 }
1312 }
1313
1314 else {
1315 query.append(BookmarksEntryModelImpl.ORDER_BY_JPQL);
1316 }
1317
1318 String sql = query.toString();
1319
1320 Query q = session.createQuery(sql);
1321
1322 q.setFirstResult(0);
1323 q.setMaxResults(2);
1324
1325 QueryPos qPos = QueryPos.getInstance(q);
1326
1327 qPos.add(groupId);
1328
1329 if (orderByComparator != null) {
1330 Object[] values = orderByComparator.getOrderByValues(bookmarksEntry);
1331
1332 for (Object value : values) {
1333 qPos.add(value);
1334 }
1335 }
1336
1337 List<BookmarksEntry> list = q.list();
1338
1339 if (list.size() == 2) {
1340 return list.get(1);
1341 }
1342 else {
1343 return null;
1344 }
1345 }
1346
1347
1354 public List<BookmarksEntry> filterFindByGroupId(long groupId)
1355 throws SystemException {
1356 return filterFindByGroupId(groupId, QueryUtil.ALL_POS,
1357 QueryUtil.ALL_POS, null);
1358 }
1359
1360
1373 public List<BookmarksEntry> filterFindByGroupId(long groupId, int start,
1374 int end) throws SystemException {
1375 return filterFindByGroupId(groupId, start, end, null);
1376 }
1377
1378
1392 public List<BookmarksEntry> filterFindByGroupId(long groupId, int start,
1393 int end, OrderByComparator orderByComparator) throws SystemException {
1394 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1395 return findByGroupId(groupId, start, end, orderByComparator);
1396 }
1397
1398 StringBundler query = null;
1399
1400 if (orderByComparator != null) {
1401 query = new StringBundler(3 +
1402 (orderByComparator.getOrderByFields().length * 3));
1403 }
1404 else {
1405 query = new StringBundler(3);
1406 }
1407
1408 if (getDB().isSupportsInlineDistinct()) {
1409 query.append(_FILTER_SQL_SELECT_BOOKMARKSENTRY_WHERE);
1410 }
1411 else {
1412 query.append(_FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_1);
1413 }
1414
1415 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1416
1417 if (!getDB().isSupportsInlineDistinct()) {
1418 query.append(_FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_2);
1419 }
1420
1421 if (orderByComparator != null) {
1422 if (getDB().isSupportsInlineDistinct()) {
1423 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1424 orderByComparator);
1425 }
1426 else {
1427 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
1428 orderByComparator);
1429 }
1430 }
1431
1432 else {
1433 if (getDB().isSupportsInlineDistinct()) {
1434 query.append(BookmarksEntryModelImpl.ORDER_BY_JPQL);
1435 }
1436 else {
1437 query.append(BookmarksEntryModelImpl.ORDER_BY_SQL);
1438 }
1439 }
1440
1441 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1442 BookmarksEntry.class.getName(), _FILTER_COLUMN_PK,
1443 _FILTER_COLUMN_USERID, groupId);
1444
1445 Session session = null;
1446
1447 try {
1448 session = openSession();
1449
1450 SQLQuery q = session.createSQLQuery(sql);
1451
1452 if (getDB().isSupportsInlineDistinct()) {
1453 q.addEntity(_FILTER_ENTITY_ALIAS, BookmarksEntryImpl.class);
1454 }
1455 else {
1456 q.addEntity(_FILTER_ENTITY_TABLE, BookmarksEntryImpl.class);
1457 }
1458
1459 QueryPos qPos = QueryPos.getInstance(q);
1460
1461 qPos.add(groupId);
1462
1463 return (List<BookmarksEntry>)QueryUtil.list(q, getDialect(), start,
1464 end);
1465 }
1466 catch (Exception e) {
1467 throw processException(e);
1468 }
1469 finally {
1470 closeSession(session);
1471 }
1472 }
1473
1474
1482 public List<BookmarksEntry> findByG_U(long groupId, long userId)
1483 throws SystemException {
1484 return findByG_U(groupId, userId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
1485 null);
1486 }
1487
1488
1502 public List<BookmarksEntry> findByG_U(long groupId, long userId, int start,
1503 int end) throws SystemException {
1504 return findByG_U(groupId, userId, start, end, null);
1505 }
1506
1507
1522 public List<BookmarksEntry> findByG_U(long groupId, long userId, int start,
1523 int end, OrderByComparator orderByComparator) throws SystemException {
1524 Object[] finderArgs = new Object[] {
1525 groupId, userId,
1526
1527 String.valueOf(start), String.valueOf(end),
1528 String.valueOf(orderByComparator)
1529 };
1530
1531 List<BookmarksEntry> list = (List<BookmarksEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_U,
1532 finderArgs, this);
1533
1534 if (list == null) {
1535 StringBundler query = null;
1536
1537 if (orderByComparator != null) {
1538 query = new StringBundler(4 +
1539 (orderByComparator.getOrderByFields().length * 3));
1540 }
1541 else {
1542 query = new StringBundler(4);
1543 }
1544
1545 query.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE);
1546
1547 query.append(_FINDER_COLUMN_G_U_GROUPID_2);
1548
1549 query.append(_FINDER_COLUMN_G_U_USERID_2);
1550
1551 if (orderByComparator != null) {
1552 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1553 orderByComparator);
1554 }
1555
1556 else {
1557 query.append(BookmarksEntryModelImpl.ORDER_BY_JPQL);
1558 }
1559
1560 String sql = query.toString();
1561
1562 Session session = null;
1563
1564 try {
1565 session = openSession();
1566
1567 Query q = session.createQuery(sql);
1568
1569 QueryPos qPos = QueryPos.getInstance(q);
1570
1571 qPos.add(groupId);
1572
1573 qPos.add(userId);
1574
1575 list = (List<BookmarksEntry>)QueryUtil.list(q, getDialect(),
1576 start, end);
1577 }
1578 catch (Exception e) {
1579 throw processException(e);
1580 }
1581 finally {
1582 if (list == null) {
1583 FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_G_U,
1584 finderArgs);
1585 }
1586 else {
1587 cacheResult(list);
1588
1589 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_U,
1590 finderArgs, list);
1591 }
1592
1593 closeSession(session);
1594 }
1595 }
1596
1597 return list;
1598 }
1599
1600
1614 public BookmarksEntry findByG_U_First(long groupId, long userId,
1615 OrderByComparator orderByComparator)
1616 throws NoSuchEntryException, SystemException {
1617 List<BookmarksEntry> list = findByG_U(groupId, userId, 0, 1,
1618 orderByComparator);
1619
1620 if (list.isEmpty()) {
1621 StringBundler msg = new StringBundler(6);
1622
1623 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1624
1625 msg.append("groupId=");
1626 msg.append(groupId);
1627
1628 msg.append(", userId=");
1629 msg.append(userId);
1630
1631 msg.append(StringPool.CLOSE_CURLY_BRACE);
1632
1633 throw new NoSuchEntryException(msg.toString());
1634 }
1635 else {
1636 return list.get(0);
1637 }
1638 }
1639
1640
1654 public BookmarksEntry findByG_U_Last(long groupId, long userId,
1655 OrderByComparator orderByComparator)
1656 throws NoSuchEntryException, SystemException {
1657 int count = countByG_U(groupId, userId);
1658
1659 List<BookmarksEntry> list = findByG_U(groupId, userId, count - 1,
1660 count, orderByComparator);
1661
1662 if (list.isEmpty()) {
1663 StringBundler msg = new StringBundler(6);
1664
1665 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1666
1667 msg.append("groupId=");
1668 msg.append(groupId);
1669
1670 msg.append(", userId=");
1671 msg.append(userId);
1672
1673 msg.append(StringPool.CLOSE_CURLY_BRACE);
1674
1675 throw new NoSuchEntryException(msg.toString());
1676 }
1677 else {
1678 return list.get(0);
1679 }
1680 }
1681
1682
1697 public BookmarksEntry[] findByG_U_PrevAndNext(long entryId, long groupId,
1698 long userId, OrderByComparator orderByComparator)
1699 throws NoSuchEntryException, SystemException {
1700 BookmarksEntry bookmarksEntry = findByPrimaryKey(entryId);
1701
1702 Session session = null;
1703
1704 try {
1705 session = openSession();
1706
1707 BookmarksEntry[] array = new BookmarksEntryImpl[3];
1708
1709 array[0] = getByG_U_PrevAndNext(session, bookmarksEntry, groupId,
1710 userId, orderByComparator, true);
1711
1712 array[1] = bookmarksEntry;
1713
1714 array[2] = getByG_U_PrevAndNext(session, bookmarksEntry, groupId,
1715 userId, orderByComparator, false);
1716
1717 return array;
1718 }
1719 catch (Exception e) {
1720 throw processException(e);
1721 }
1722 finally {
1723 closeSession(session);
1724 }
1725 }
1726
1727 protected BookmarksEntry getByG_U_PrevAndNext(Session session,
1728 BookmarksEntry bookmarksEntry, long groupId, long userId,
1729 OrderByComparator orderByComparator, boolean previous) {
1730 StringBundler query = null;
1731
1732 if (orderByComparator != null) {
1733 query = new StringBundler(6 +
1734 (orderByComparator.getOrderByFields().length * 6));
1735 }
1736 else {
1737 query = new StringBundler(3);
1738 }
1739
1740 query.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE);
1741
1742 query.append(_FINDER_COLUMN_G_U_GROUPID_2);
1743
1744 query.append(_FINDER_COLUMN_G_U_USERID_2);
1745
1746 if (orderByComparator != null) {
1747 String[] orderByFields = orderByComparator.getOrderByFields();
1748
1749 if (orderByFields.length > 0) {
1750 query.append(WHERE_AND);
1751 }
1752
1753 for (int i = 0; i < orderByFields.length; i++) {
1754 query.append(_ORDER_BY_ENTITY_ALIAS);
1755 query.append(orderByFields[i]);
1756
1757 if ((i + 1) < orderByFields.length) {
1758 if (orderByComparator.isAscending() ^ previous) {
1759 query.append(WHERE_GREATER_THAN_HAS_NEXT);
1760 }
1761 else {
1762 query.append(WHERE_LESSER_THAN_HAS_NEXT);
1763 }
1764 }
1765 else {
1766 if (orderByComparator.isAscending() ^ previous) {
1767 query.append(WHERE_GREATER_THAN);
1768 }
1769 else {
1770 query.append(WHERE_LESSER_THAN);
1771 }
1772 }
1773 }
1774
1775 query.append(ORDER_BY_CLAUSE);
1776
1777 for (int i = 0; i < orderByFields.length; i++) {
1778 query.append(_ORDER_BY_ENTITY_ALIAS);
1779 query.append(orderByFields[i]);
1780
1781 if ((i + 1) < orderByFields.length) {
1782 if (orderByComparator.isAscending() ^ previous) {
1783 query.append(ORDER_BY_ASC_HAS_NEXT);
1784 }
1785 else {
1786 query.append(ORDER_BY_DESC_HAS_NEXT);
1787 }
1788 }
1789 else {
1790 if (orderByComparator.isAscending() ^ previous) {
1791 query.append(ORDER_BY_ASC);
1792 }
1793 else {
1794 query.append(ORDER_BY_DESC);
1795 }
1796 }
1797 }
1798 }
1799
1800 else {
1801 query.append(BookmarksEntryModelImpl.ORDER_BY_JPQL);
1802 }
1803
1804 String sql = query.toString();
1805
1806 Query q = session.createQuery(sql);
1807
1808 q.setFirstResult(0);
1809 q.setMaxResults(2);
1810
1811 QueryPos qPos = QueryPos.getInstance(q);
1812
1813 qPos.add(groupId);
1814
1815 qPos.add(userId);
1816
1817 if (orderByComparator != null) {
1818 Object[] values = orderByComparator.getOrderByValues(bookmarksEntry);
1819
1820 for (Object value : values) {
1821 qPos.add(value);
1822 }
1823 }
1824
1825 List<BookmarksEntry> list = q.list();
1826
1827 if (list.size() == 2) {
1828 return list.get(1);
1829 }
1830 else {
1831 return null;
1832 }
1833 }
1834
1835
1843 public List<BookmarksEntry> filterFindByG_U(long groupId, long userId)
1844 throws SystemException {
1845 return filterFindByG_U(groupId, userId, QueryUtil.ALL_POS,
1846 QueryUtil.ALL_POS, null);
1847 }
1848
1849
1863 public List<BookmarksEntry> filterFindByG_U(long groupId, long userId,
1864 int start, int end) throws SystemException {
1865 return filterFindByG_U(groupId, userId, start, end, null);
1866 }
1867
1868
1883 public List<BookmarksEntry> filterFindByG_U(long groupId, long userId,
1884 int start, int end, OrderByComparator orderByComparator)
1885 throws SystemException {
1886 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1887 return findByG_U(groupId, userId, start, end, orderByComparator);
1888 }
1889
1890 StringBundler query = null;
1891
1892 if (orderByComparator != null) {
1893 query = new StringBundler(4 +
1894 (orderByComparator.getOrderByFields().length * 3));
1895 }
1896 else {
1897 query = new StringBundler(4);
1898 }
1899
1900 if (getDB().isSupportsInlineDistinct()) {
1901 query.append(_FILTER_SQL_SELECT_BOOKMARKSENTRY_WHERE);
1902 }
1903 else {
1904 query.append(_FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_1);
1905 }
1906
1907 query.append(_FINDER_COLUMN_G_U_GROUPID_2);
1908
1909 query.append(_FINDER_COLUMN_G_U_USERID_2);
1910
1911 if (!getDB().isSupportsInlineDistinct()) {
1912 query.append(_FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_2);
1913 }
1914
1915 if (orderByComparator != null) {
1916 if (getDB().isSupportsInlineDistinct()) {
1917 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1918 orderByComparator);
1919 }
1920 else {
1921 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
1922 orderByComparator);
1923 }
1924 }
1925
1926 else {
1927 if (getDB().isSupportsInlineDistinct()) {
1928 query.append(BookmarksEntryModelImpl.ORDER_BY_JPQL);
1929 }
1930 else {
1931 query.append(BookmarksEntryModelImpl.ORDER_BY_SQL);
1932 }
1933 }
1934
1935 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1936 BookmarksEntry.class.getName(), _FILTER_COLUMN_PK,
1937 _FILTER_COLUMN_USERID, groupId);
1938
1939 Session session = null;
1940
1941 try {
1942 session = openSession();
1943
1944 SQLQuery q = session.createSQLQuery(sql);
1945
1946 if (getDB().isSupportsInlineDistinct()) {
1947 q.addEntity(_FILTER_ENTITY_ALIAS, BookmarksEntryImpl.class);
1948 }
1949 else {
1950 q.addEntity(_FILTER_ENTITY_TABLE, BookmarksEntryImpl.class);
1951 }
1952
1953 QueryPos qPos = QueryPos.getInstance(q);
1954
1955 qPos.add(groupId);
1956
1957 qPos.add(userId);
1958
1959 return (List<BookmarksEntry>)QueryUtil.list(q, getDialect(), start,
1960 end);
1961 }
1962 catch (Exception e) {
1963 throw processException(e);
1964 }
1965 finally {
1966 closeSession(session);
1967 }
1968 }
1969
1970
1978 public List<BookmarksEntry> findByG_F(long groupId, long folderId)
1979 throws SystemException {
1980 return findByG_F(groupId, folderId, QueryUtil.ALL_POS,
1981 QueryUtil.ALL_POS, null);
1982 }
1983
1984
1998 public List<BookmarksEntry> findByG_F(long groupId, long folderId,
1999 int start, int end) throws SystemException {
2000 return findByG_F(groupId, folderId, start, end, null);
2001 }
2002
2003
2018 public List<BookmarksEntry> findByG_F(long groupId, long folderId,
2019 int start, int end, OrderByComparator orderByComparator)
2020 throws SystemException {
2021 Object[] finderArgs = new Object[] {
2022 groupId, folderId,
2023
2024 String.valueOf(start), String.valueOf(end),
2025 String.valueOf(orderByComparator)
2026 };
2027
2028 List<BookmarksEntry> list = (List<BookmarksEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_F,
2029 finderArgs, this);
2030
2031 if (list == null) {
2032 StringBundler query = null;
2033
2034 if (orderByComparator != null) {
2035 query = new StringBundler(4 +
2036 (orderByComparator.getOrderByFields().length * 3));
2037 }
2038 else {
2039 query = new StringBundler(4);
2040 }
2041
2042 query.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE);
2043
2044 query.append(_FINDER_COLUMN_G_F_GROUPID_2);
2045
2046 query.append(_FINDER_COLUMN_G_F_FOLDERID_2);
2047
2048 if (orderByComparator != null) {
2049 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2050 orderByComparator);
2051 }
2052
2053 else {
2054 query.append(BookmarksEntryModelImpl.ORDER_BY_JPQL);
2055 }
2056
2057 String sql = query.toString();
2058
2059 Session session = null;
2060
2061 try {
2062 session = openSession();
2063
2064 Query q = session.createQuery(sql);
2065
2066 QueryPos qPos = QueryPos.getInstance(q);
2067
2068 qPos.add(groupId);
2069
2070 qPos.add(folderId);
2071
2072 list = (List<BookmarksEntry>)QueryUtil.list(q, getDialect(),
2073 start, end);
2074 }
2075 catch (Exception e) {
2076 throw processException(e);
2077 }
2078 finally {
2079 if (list == null) {
2080 FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_G_F,
2081 finderArgs);
2082 }
2083 else {
2084 cacheResult(list);
2085
2086 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_F,
2087 finderArgs, list);
2088 }
2089
2090 closeSession(session);
2091 }
2092 }
2093
2094 return list;
2095 }
2096
2097
2111 public BookmarksEntry findByG_F_First(long groupId, long folderId,
2112 OrderByComparator orderByComparator)
2113 throws NoSuchEntryException, SystemException {
2114 List<BookmarksEntry> list = findByG_F(groupId, folderId, 0, 1,
2115 orderByComparator);
2116
2117 if (list.isEmpty()) {
2118 StringBundler msg = new StringBundler(6);
2119
2120 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2121
2122 msg.append("groupId=");
2123 msg.append(groupId);
2124
2125 msg.append(", folderId=");
2126 msg.append(folderId);
2127
2128 msg.append(StringPool.CLOSE_CURLY_BRACE);
2129
2130 throw new NoSuchEntryException(msg.toString());
2131 }
2132 else {
2133 return list.get(0);
2134 }
2135 }
2136
2137
2151 public BookmarksEntry findByG_F_Last(long groupId, long folderId,
2152 OrderByComparator orderByComparator)
2153 throws NoSuchEntryException, SystemException {
2154 int count = countByG_F(groupId, folderId);
2155
2156 List<BookmarksEntry> list = findByG_F(groupId, folderId, count - 1,
2157 count, orderByComparator);
2158
2159 if (list.isEmpty()) {
2160 StringBundler msg = new StringBundler(6);
2161
2162 msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2163
2164 msg.append("groupId=");
2165 msg.append(groupId);
2166
2167 msg.append(", folderId=");
2168 msg.append(folderId);
2169
2170 msg.append(StringPool.CLOSE_CURLY_BRACE);
2171
2172 throw new NoSuchEntryException(msg.toString());
2173 }
2174 else {
2175 return list.get(0);
2176 }
2177 }
2178
2179
2194 public BookmarksEntry[] findByG_F_PrevAndNext(long entryId, long groupId,
2195 long folderId, OrderByComparator orderByComparator)
2196 throws NoSuchEntryException, SystemException {
2197 BookmarksEntry bookmarksEntry = findByPrimaryKey(entryId);
2198
2199 Session session = null;
2200
2201 try {
2202 session = openSession();
2203
2204 BookmarksEntry[] array = new BookmarksEntryImpl[3];
2205
2206 array[0] = getByG_F_PrevAndNext(session, bookmarksEntry, groupId,
2207 folderId, orderByComparator, true);
2208
2209 array[1] = bookmarksEntry;
2210
2211 array[2] = getByG_F_PrevAndNext(session, bookmarksEntry, groupId,
2212 folderId, orderByComparator, false);
2213
2214 return array;
2215 }
2216 catch (Exception e) {
2217 throw processException(e);
2218 }
2219 finally {
2220 closeSession(session);
2221 }
2222 }
2223
2224 protected BookmarksEntry getByG_F_PrevAndNext(Session session,
2225 BookmarksEntry bookmarksEntry, long groupId, long folderId,
2226 OrderByComparator orderByComparator, boolean previous) {
2227 StringBundler query = null;
2228
2229 if (orderByComparator != null) {
2230 query = new StringBundler(6 +
2231 (orderByComparator.getOrderByFields().length * 6));
2232 }
2233 else {
2234 query = new StringBundler(3);
2235 }
2236
2237 query.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE);
2238
2239 query.append(_FINDER_COLUMN_G_F_GROUPID_2);
2240
2241 query.append(_FINDER_COLUMN_G_F_FOLDERID_2);
2242
2243 if (orderByComparator != null) {
2244 String[] orderByFields = orderByComparator.getOrderByFields();
2245
2246 if (orderByFields.length > 0) {
2247 query.append(WHERE_AND);
2248 }
2249
2250 for (int i = 0; i < orderByFields.length; i++) {
2251 query.append(_ORDER_BY_ENTITY_ALIAS);
2252 query.append(orderByFields[i]);
2253
2254 if ((i + 1) < orderByFields.length) {
2255 if (orderByComparator.isAscending() ^ previous) {
2256 query.append(WHERE_GREATER_THAN_HAS_NEXT);
2257 }
2258 else {
2259 query.append(WHERE_LESSER_THAN_HAS_NEXT);
2260 }
2261 }
2262 else {
2263 if (orderByComparator.isAscending() ^ previous) {
2264 query.append(WHERE_GREATER_THAN);
2265 }
2266 else {
2267 query.append(WHERE_LESSER_THAN);
2268 }
2269 }
2270 }
2271
2272 query.append(ORDER_BY_CLAUSE);
2273
2274 for (int i = 0; i < orderByFields.length; i++) {
2275 query.append(_ORDER_BY_ENTITY_ALIAS);
2276 query.append(orderByFields[i]);
2277
2278 if ((i + 1) < orderByFields.length) {
2279 if (orderByComparator.isAscending() ^ previous) {
2280 query.append(ORDER_BY_ASC_HAS_NEXT);
2281 }
2282 else {
2283 query.append(ORDER_BY_DESC_HAS_NEXT);
2284 }
2285 }
2286 else {
2287 if (orderByComparator.isAscending() ^ previous) {
2288 query.append(ORDER_BY_ASC);
2289 }
2290 else {
2291 query.append(ORDER_BY_DESC);
2292 }
2293 }
2294 }
2295 }
2296
2297 else {
2298 query.append(BookmarksEntryModelImpl.ORDER_BY_JPQL);
2299 }
2300
2301 String sql = query.toString();
2302
2303 Query q = session.createQuery(sql);
2304
2305 q.setFirstResult(0);
2306 q.setMaxResults(2);
2307
2308 QueryPos qPos = QueryPos.getInstance(q);
2309
2310 qPos.add(groupId);
2311
2312 qPos.add(folderId);
2313
2314 if (orderByComparator != null) {
2315 Object[] values = orderByComparator.getOrderByValues(bookmarksEntry);
2316
2317 for (Object value : values) {
2318 qPos.add(value);
2319 }
2320 }
2321
2322 List<BookmarksEntry> list = q.list();
2323
2324 if (list.size() == 2) {
2325 return list.get(1);
2326 }
2327 else {
2328 return null;
2329 }
2330 }
2331
2332
2344 public List<BookmarksEntry> findByG_F(long groupId, long[] folderIds)
2345 throws SystemException {
2346 return findByG_F(groupId, folderIds, QueryUtil.ALL_POS,
2347 QueryUtil.ALL_POS, null);
2348 }
2349
2350
2364 public List<BookmarksEntry> findByG_F(long groupId, long[] folderIds,
2365 int start, int end) throws SystemException {
2366 return findByG_F(groupId, folderIds, start, end, null);
2367 }
2368
2369
2384 public List<BookmarksEntry> findByG_F(long groupId, long[] folderIds,
2385 int start, int end, OrderByComparator orderByComparator)
2386 throws SystemException {
2387 Object[] finderArgs = new Object[] {
2388 groupId, StringUtil.merge(folderIds),
2389
2390 String.valueOf(start), String.valueOf(end),
2391 String.valueOf(orderByComparator)
2392 };
2393
2394 List<BookmarksEntry> list = (List<BookmarksEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_F,
2395 finderArgs, this);
2396
2397 if (list == null) {
2398 StringBundler query = new StringBundler();
2399
2400 query.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE);
2401
2402 boolean conjunctionable = false;
2403
2404 if (conjunctionable) {
2405 query.append(WHERE_AND);
2406 }
2407
2408 query.append(_FINDER_COLUMN_G_F_GROUPID_5);
2409
2410 conjunctionable = true;
2411
2412 if ((folderIds == null) || (folderIds.length > 0)) {
2413 if (conjunctionable) {
2414 query.append(WHERE_AND);
2415 }
2416
2417 query.append(StringPool.OPEN_PARENTHESIS);
2418
2419 for (int i = 0; i < folderIds.length; i++) {
2420 query.append(_FINDER_COLUMN_G_F_FOLDERID_5);
2421
2422 if ((i + 1) < folderIds.length) {
2423 query.append(WHERE_OR);
2424 }
2425 }
2426
2427 query.append(StringPool.CLOSE_PARENTHESIS);
2428
2429 conjunctionable = true;
2430 }
2431
2432 if (orderByComparator != null) {
2433 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2434 orderByComparator);
2435 }
2436
2437 else {
2438 query.append(BookmarksEntryModelImpl.ORDER_BY_JPQL);
2439 }
2440
2441 String sql = query.toString();
2442
2443 Session session = null;
2444
2445 try {
2446 session = openSession();
2447
2448 Query q = session.createQuery(sql);
2449
2450 QueryPos qPos = QueryPos.getInstance(q);
2451
2452 qPos.add(groupId);
2453
2454 if (folderIds != null) {
2455 qPos.add(folderIds);
2456 }
2457
2458 list = (List<BookmarksEntry>)QueryUtil.list(q, getDialect(),
2459 start, end);
2460 }
2461 catch (Exception e) {
2462 throw processException(e);
2463 }
2464 finally {
2465 if (list == null) {
2466 FinderCacheUtil.removeResult(FINDER_PATH_FIND_BY_G_F,
2467 finderArgs);
2468 }
2469 else {
2470 cacheResult(list);
2471
2472 FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_F,
2473 finderArgs, list);
2474 }
2475
2476 closeSession(session);
2477 }
2478 }
2479
2480 return list;
2481 }
2482
2483
2491 public List<BookmarksEntry> filterFindByG_F(long groupId, long folderId)
2492 throws SystemException {
2493 return filterFindByG_F(groupId, folderId, QueryUtil.ALL_POS,
2494 QueryUtil.ALL_POS, null);
2495 }
2496
2497
2511 public List<BookmarksEntry> filterFindByG_F(long groupId, long folderId,
2512 int start, int end) throws SystemException {
2513 return filterFindByG_F(groupId, folderId, start, end, null);
2514 }
2515
2516
2531 public List<BookmarksEntry> filterFindByG_F(long groupId, long folderId,
2532 int start, int end, OrderByComparator orderByComparator)
2533 throws SystemException {
2534 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2535 return findByG_F(groupId, folderId, start, end, orderByComparator);
2536 }
2537
2538 StringBundler query = null;
2539
2540 if (orderByComparator != null) {
2541 query = new StringBundler(4 +
2542 (orderByComparator.getOrderByFields().length * 3));
2543 }
2544 else {
2545 query = new StringBundler(4);
2546 }
2547
2548 if (getDB().isSupportsInlineDistinct()) {
2549 query.append(_FILTER_SQL_SELECT_BOOKMARKSENTRY_WHERE);
2550 }
2551 else {
2552 query.append(_FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_1);
2553 }
2554
2555 query.append(_FINDER_COLUMN_G_F_GROUPID_2);
2556
2557 query.append(_FINDER_COLUMN_G_F_FOLDERID_2);
2558
2559 if (!getDB().isSupportsInlineDistinct()) {
2560 query.append(_FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_2);
2561 }
2562
2563 if (orderByComparator != null) {
2564 if (getDB().isSupportsInlineDistinct()) {
2565 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2566 orderByComparator);
2567 }
2568 else {
2569 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
2570 orderByComparator);
2571 }
2572 }
2573
2574 else {
2575 if (getDB().isSupportsInlineDistinct()) {
2576 query.append(BookmarksEntryModelImpl.ORDER_BY_JPQL);
2577 }
2578 else {
2579 query.append(BookmarksEntryModelImpl.ORDER_BY_SQL);
2580 }
2581 }
2582
2583 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2584 BookmarksEntry.class.getName(), _FILTER_COLUMN_PK,
2585 _FILTER_COLUMN_USERID, groupId);
2586
2587 Session session = null;
2588
2589 try {
2590 session = openSession();
2591
2592 SQLQuery q = session.createSQLQuery(sql);
2593
2594 if (getDB().isSupportsInlineDistinct()) {
2595 q.addEntity(_FILTER_ENTITY_ALIAS, BookmarksEntryImpl.class);
2596 }
2597 else {
2598 q.addEntity(_FILTER_ENTITY_TABLE, BookmarksEntryImpl.class);
2599 }
2600
2601 QueryPos qPos = QueryPos.getInstance(q);
2602
2603 qPos.add(groupId);
2604
2605 qPos.add(folderId);
2606
2607 return (List<BookmarksEntry>)QueryUtil.list(q, getDialect(), start,
2608 end);
2609 }
2610 catch (Exception e) {
2611 throw processException(e);
2612 }
2613 finally {
2614 closeSession(session);
2615 }
2616 }
2617
2618
2630 public List<BookmarksEntry> filterFindByG_F(long groupId, long[] folderIds)
2631 throws SystemException {
2632 return filterFindByG_F(groupId, folderIds, QueryUtil.ALL_POS,
2633 QueryUtil.ALL_POS, null);
2634 }
2635
2636
2650 public List<BookmarksEntry> filterFindByG_F(long groupId, long[] folderIds,
2651 int start, int end) throws SystemException {
2652 return filterFindByG_F(groupId, folderIds, start, end, null);
2653 }
2654
2655
2670 public List<BookmarksEntry> filterFindByG_F(long groupId, long[] folderIds,
2671 int start, int end, OrderByComparator orderByComparator)
2672 throws SystemException {
2673 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2674 return findByG_F(groupId, folderIds, start, end, orderByComparator);
2675 }
2676
2677 StringBundler query = new StringBundler();
2678
2679 if (getDB().isSupportsInlineDistinct()) {
2680 query.append(_FILTER_SQL_SELECT_BOOKMARKSENTRY_WHERE);
2681 }
2682 else {
2683 query.append(_FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_1);
2684 }
2685
2686 boolean conjunctionable = false;
2687
2688 if (conjunctionable) {
2689 query.append(WHERE_AND);
2690 }
2691
2692 query.append(_FINDER_COLUMN_G_F_GROUPID_5);
2693
2694 conjunctionable = true;
2695
2696 if ((folderIds == null) || (folderIds.length > 0)) {
2697 if (conjunctionable) {
2698 query.append(WHERE_AND);
2699 }
2700
2701 query.append(StringPool.OPEN_PARENTHESIS);
2702
2703 for (int i = 0; i < folderIds.length; i++) {
2704 query.append(_FINDER_COLUMN_G_F_FOLDERID_5);
2705
2706 if ((i + 1) < folderIds.length) {
2707 query.append(WHERE_OR);
2708 }
2709 }
2710
2711 query.append(StringPool.CLOSE_PARENTHESIS);
2712
2713 conjunctionable = true;
2714 }
2715
2716 if (!getDB().isSupportsInlineDistinct()) {
2717 query.append(_FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_2);
2718 }
2719
2720 if (orderByComparator != null) {
2721 if (getDB().isSupportsInlineDistinct()) {
2722 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2723 orderByComparator);
2724 }
2725 else {
2726 appendOrderByComparator(query, _ORDER_BY_ENTITY_TABLE,
2727 orderByComparator);
2728 }
2729 }
2730
2731 else {
2732 if (getDB().isSupportsInlineDistinct()) {
2733 query.append(BookmarksEntryModelImpl.ORDER_BY_JPQL);
2734 }
2735 else {
2736 query.append(BookmarksEntryModelImpl.ORDER_BY_SQL);
2737 }
2738 }
2739
2740 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2741 BookmarksEntry.class.getName(), _FILTER_COLUMN_PK,
2742 _FILTER_COLUMN_USERID, groupId);
2743
2744 Session session = null;
2745
2746 try {
2747 session = openSession();
2748
2749 SQLQuery q = session.createSQLQuery(sql);
2750
2751 if (getDB().isSupportsInlineDistinct()) {
2752 q.addEntity(_FILTER_ENTITY_ALIAS, BookmarksEntryImpl.class);
2753 }
2754 else {
2755 q.addEntity(_FILTER_ENTITY_TABLE, BookmarksEntryImpl.class);
2756 }
2757
2758 QueryPos qPos = QueryPos.getInstance(q);
2759
2760 qPos.add(groupId);
2761
2762 if (folderIds != null) {
2763 qPos.add(folderIds);
2764 }
2765
2766 return (List<BookmarksEntry>)QueryUtil.list(q, getDialect(), start,
2767 end);
2768 }
2769 catch (Exception e) {
2770 throw processException(e);
2771 }
2772 finally {
2773 closeSession(session);
2774 }
2775 }
2776
2777
2783 public List<BookmarksEntry> findAll() throws SystemException {
2784 return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2785 }
2786
2787
2799 public List<BookmarksEntry> findAll(int start, int end)
2800 throws SystemException {
2801 return findAll(start, end, null);
2802 }
2803
2804
2817 public List<BookmarksEntry> findAll(int start, int end,
2818 OrderByComparator orderByComparator) throws SystemException {
2819 Object[] finderArgs = new Object[] {
2820 String.valueOf(start), String.valueOf(end),
2821 String.valueOf(orderByComparator)
2822 };
2823
2824 List<BookmarksEntry> list = (List<BookmarksEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
2825 finderArgs, this);
2826
2827 if (list == null) {
2828 StringBundler query = null;
2829 String sql = null;
2830
2831 if (orderByComparator != null) {
2832 query = new StringBundler(2 +
2833 (orderByComparator.getOrderByFields().length * 3));
2834
2835 query.append(_SQL_SELECT_BOOKMARKSENTRY);
2836
2837 appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2838 orderByComparator);
2839
2840 sql = query.toString();
2841 }
2842 else {
2843 sql = _SQL_SELECT_BOOKMARKSENTRY.concat(BookmarksEntryModelImpl.ORDER_BY_JPQL);
2844 }
2845
2846 Session session = null;
2847
2848 try {
2849 session = openSession();
2850
2851 Query q = session.createQuery(sql);
2852
2853 if (orderByComparator == null) {
2854 list = (List<BookmarksEntry>)QueryUtil.list(q,
2855 getDialect(), start, end, false);
2856
2857 Collections.sort(list);
2858 }
2859 else {
2860 list = (List<BookmarksEntry>)QueryUtil.list(q,
2861 getDialect(), start, end);
2862 }
2863 }
2864 catch (Exception e) {
2865 throw processException(e);
2866 }
2867 finally {
2868 if (list == null) {
2869 FinderCacheUtil.removeResult(FINDER_PATH_FIND_ALL,
2870 finderArgs);
2871 }
2872 else {
2873 cacheResult(list);
2874
2875 FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs,
2876 list);
2877 }
2878
2879 closeSession(session);
2880 }
2881 }
2882
2883 return list;
2884 }
2885
2886
2892 public void removeByUuid(String uuid) throws SystemException {
2893 for (BookmarksEntry bookmarksEntry : findByUuid(uuid)) {
2894 remove(bookmarksEntry);
2895 }
2896 }
2897
2898
2905 public void removeByUUID_G(String uuid, long groupId)
2906 throws NoSuchEntryException, SystemException {
2907 BookmarksEntry bookmarksEntry = findByUUID_G(uuid, groupId);
2908
2909 remove(bookmarksEntry);
2910 }
2911
2912
2918 public void removeByGroupId(long groupId) throws SystemException {
2919 for (BookmarksEntry bookmarksEntry : findByGroupId(groupId)) {
2920 remove(bookmarksEntry);
2921 }
2922 }
2923
2924
2931 public void removeByG_U(long groupId, long userId)
2932 throws SystemException {
2933 for (BookmarksEntry bookmarksEntry : findByG_U(groupId, userId)) {
2934 remove(bookmarksEntry);
2935 }
2936 }
2937
2938
2945 public void removeByG_F(long groupId, long folderId)
2946 throws SystemException {
2947 for (BookmarksEntry bookmarksEntry : findByG_F(groupId, folderId)) {
2948 remove(bookmarksEntry);
2949 }
2950 }
2951
2952
2957 public void removeAll() throws SystemException {
2958 for (BookmarksEntry bookmarksEntry : findAll()) {
2959 remove(bookmarksEntry);
2960 }
2961 }
2962
2963
2970 public int countByUuid(String uuid) throws SystemException {
2971 Object[] finderArgs = new Object[] { uuid };
2972
2973 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
2974 finderArgs, this);
2975
2976 if (count == null) {
2977 StringBundler query = new StringBundler(2);
2978
2979 query.append(_SQL_COUNT_BOOKMARKSENTRY_WHERE);
2980
2981 if (uuid == null) {
2982 query.append(_FINDER_COLUMN_UUID_UUID_1);
2983 }
2984 else {
2985 if (uuid.equals(StringPool.BLANK)) {
2986 query.append(_FINDER_COLUMN_UUID_UUID_3);
2987 }
2988 else {
2989 query.append(_FINDER_COLUMN_UUID_UUID_2);
2990 }
2991 }
2992
2993 String sql = query.toString();
2994
2995 Session session = null;
2996
2997 try {
2998 session = openSession();
2999
3000 Query q = session.createQuery(sql);
3001
3002 QueryPos qPos = QueryPos.getInstance(q);
3003
3004 if (uuid != null) {
3005 qPos.add(uuid);
3006 }
3007
3008 count = (Long)q.uniqueResult();
3009 }
3010 catch (Exception e) {
3011 throw processException(e);
3012 }
3013 finally {
3014 if (count == null) {
3015 count = Long.valueOf(0);
3016 }
3017
3018 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
3019 finderArgs, count);
3020
3021 closeSession(session);
3022 }
3023 }
3024
3025 return count.intValue();
3026 }
3027
3028
3036 public int countByUUID_G(String uuid, long groupId)
3037 throws SystemException {
3038 Object[] finderArgs = new Object[] { uuid, groupId };
3039
3040 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID_G,
3041 finderArgs, this);
3042
3043 if (count == null) {
3044 StringBundler query = new StringBundler(3);
3045
3046 query.append(_SQL_COUNT_BOOKMARKSENTRY_WHERE);
3047
3048 if (uuid == null) {
3049 query.append(_FINDER_COLUMN_UUID_G_UUID_1);
3050 }
3051 else {
3052 if (uuid.equals(StringPool.BLANK)) {
3053 query.append(_FINDER_COLUMN_UUID_G_UUID_3);
3054 }
3055 else {
3056 query.append(_FINDER_COLUMN_UUID_G_UUID_2);
3057 }
3058 }
3059
3060 query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
3061
3062 String sql = query.toString();
3063
3064 Session session = null;
3065
3066 try {
3067 session = openSession();
3068
3069 Query q = session.createQuery(sql);
3070
3071 QueryPos qPos = QueryPos.getInstance(q);
3072
3073 if (uuid != null) {
3074 qPos.add(uuid);
3075 }
3076
3077 qPos.add(groupId);
3078
3079 count = (Long)q.uniqueResult();
3080 }
3081 catch (Exception e) {
3082 throw processException(e);
3083 }
3084 finally {
3085 if (count == null) {
3086 count = Long.valueOf(0);
3087 }
3088
3089 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID_G,
3090 finderArgs, count);
3091
3092 closeSession(session);
3093 }
3094 }
3095
3096 return count.intValue();
3097 }
3098
3099
3106 public int countByGroupId(long groupId) throws SystemException {
3107 Object[] finderArgs = new Object[] { groupId };
3108
3109 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
3110 finderArgs, this);
3111
3112 if (count == null) {
3113 StringBundler query = new StringBundler(2);
3114
3115 query.append(_SQL_COUNT_BOOKMARKSENTRY_WHERE);
3116
3117 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
3118
3119 String sql = query.toString();
3120
3121 Session session = null;
3122
3123 try {
3124 session = openSession();
3125
3126 Query q = session.createQuery(sql);
3127
3128 QueryPos qPos = QueryPos.getInstance(q);
3129
3130 qPos.add(groupId);
3131
3132 count = (Long)q.uniqueResult();
3133 }
3134 catch (Exception e) {
3135 throw processException(e);
3136 }
3137 finally {
3138 if (count == null) {
3139 count = Long.valueOf(0);
3140 }
3141
3142 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
3143 finderArgs, count);
3144
3145 closeSession(session);
3146 }
3147 }
3148
3149 return count.intValue();
3150 }
3151
3152
3159 public int filterCountByGroupId(long groupId) throws SystemException {
3160 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
3161 return countByGroupId(groupId);
3162 }
3163
3164 StringBundler query = new StringBundler(2);
3165
3166 query.append(_FILTER_SQL_COUNT_BOOKMARKSENTRY_WHERE);
3167
3168 query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
3169
3170 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3171 BookmarksEntry.class.getName(), _FILTER_COLUMN_PK,
3172 _FILTER_COLUMN_USERID, groupId);
3173
3174 Session session = null;
3175
3176 try {
3177 session = openSession();
3178
3179 SQLQuery q = session.createSQLQuery(sql);
3180
3181 q.addScalar(COUNT_COLUMN_NAME,
3182 com.liferay.portal.kernel.dao.orm.Type.LONG);
3183
3184 QueryPos qPos = QueryPos.getInstance(q);
3185
3186 qPos.add(groupId);
3187
3188 Long count = (Long)q.uniqueResult();
3189
3190 return count.intValue();
3191 }
3192 catch (Exception e) {
3193 throw processException(e);
3194 }
3195 finally {
3196 closeSession(session);
3197 }
3198 }
3199
3200
3208 public int countByG_U(long groupId, long userId) throws SystemException {
3209 Object[] finderArgs = new Object[] { groupId, userId };
3210
3211 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_U,
3212 finderArgs, this);
3213
3214 if (count == null) {
3215 StringBundler query = new StringBundler(3);
3216
3217 query.append(_SQL_COUNT_BOOKMARKSENTRY_WHERE);
3218
3219 query.append(_FINDER_COLUMN_G_U_GROUPID_2);
3220
3221 query.append(_FINDER_COLUMN_G_U_USERID_2);
3222
3223 String sql = query.toString();
3224
3225 Session session = null;
3226
3227 try {
3228 session = openSession();
3229
3230 Query q = session.createQuery(sql);
3231
3232 QueryPos qPos = QueryPos.getInstance(q);
3233
3234 qPos.add(groupId);
3235
3236 qPos.add(userId);
3237
3238 count = (Long)q.uniqueResult();
3239 }
3240 catch (Exception e) {
3241 throw processException(e);
3242 }
3243 finally {
3244 if (count == null) {
3245 count = Long.valueOf(0);
3246 }
3247
3248 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_U, finderArgs,
3249 count);
3250
3251 closeSession(session);
3252 }
3253 }
3254
3255 return count.intValue();
3256 }
3257
3258
3266 public int filterCountByG_U(long groupId, long userId)
3267 throws SystemException {
3268 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
3269 return countByG_U(groupId, userId);
3270 }
3271
3272 StringBundler query = new StringBundler(3);
3273
3274 query.append(_FILTER_SQL_COUNT_BOOKMARKSENTRY_WHERE);
3275
3276 query.append(_FINDER_COLUMN_G_U_GROUPID_2);
3277
3278 query.append(_FINDER_COLUMN_G_U_USERID_2);
3279
3280 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3281 BookmarksEntry.class.getName(), _FILTER_COLUMN_PK,
3282 _FILTER_COLUMN_USERID, groupId);
3283
3284 Session session = null;
3285
3286 try {
3287 session = openSession();
3288
3289 SQLQuery q = session.createSQLQuery(sql);
3290
3291 q.addScalar(COUNT_COLUMN_NAME,
3292 com.liferay.portal.kernel.dao.orm.Type.LONG);
3293
3294 QueryPos qPos = QueryPos.getInstance(q);
3295
3296 qPos.add(groupId);
3297
3298 qPos.add(userId);
3299
3300 Long count = (Long)q.uniqueResult();
3301
3302 return count.intValue();
3303 }
3304 catch (Exception e) {
3305 throw processException(e);
3306 }
3307 finally {
3308 closeSession(session);
3309 }
3310 }
3311
3312
3320 public int countByG_F(long groupId, long folderId)
3321 throws SystemException {
3322 Object[] finderArgs = new Object[] { groupId, folderId };
3323
3324 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_F,
3325 finderArgs, this);
3326
3327 if (count == null) {
3328 StringBundler query = new StringBundler(3);
3329
3330 query.append(_SQL_COUNT_BOOKMARKSENTRY_WHERE);
3331
3332 query.append(_FINDER_COLUMN_G_F_GROUPID_2);
3333
3334 query.append(_FINDER_COLUMN_G_F_FOLDERID_2);
3335
3336 String sql = query.toString();
3337
3338 Session session = null;
3339
3340 try {
3341 session = openSession();
3342
3343 Query q = session.createQuery(sql);
3344
3345 QueryPos qPos = QueryPos.getInstance(q);
3346
3347 qPos.add(groupId);
3348
3349 qPos.add(folderId);
3350
3351 count = (Long)q.uniqueResult();
3352 }
3353 catch (Exception e) {
3354 throw processException(e);
3355 }
3356 finally {
3357 if (count == null) {
3358 count = Long.valueOf(0);
3359 }
3360
3361 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_F, finderArgs,
3362 count);
3363
3364 closeSession(session);
3365 }
3366 }
3367
3368 return count.intValue();
3369 }
3370
3371
3379 public int countByG_F(long groupId, long[] folderIds)
3380 throws SystemException {
3381 Object[] finderArgs = new Object[] { groupId, StringUtil.merge(folderIds) };
3382
3383 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_F,
3384 finderArgs, this);
3385
3386 if (count == null) {
3387 StringBundler query = new StringBundler();
3388
3389 query.append(_SQL_COUNT_BOOKMARKSENTRY_WHERE);
3390
3391 boolean conjunctionable = false;
3392
3393 if (conjunctionable) {
3394 query.append(WHERE_AND);
3395 }
3396
3397 query.append(_FINDER_COLUMN_G_F_GROUPID_5);
3398
3399 conjunctionable = true;
3400
3401 if ((folderIds == null) || (folderIds.length > 0)) {
3402 if (conjunctionable) {
3403 query.append(WHERE_AND);
3404 }
3405
3406 query.append(StringPool.OPEN_PARENTHESIS);
3407
3408 for (int i = 0; i < folderIds.length; i++) {
3409 query.append(_FINDER_COLUMN_G_F_FOLDERID_5);
3410
3411 if ((i + 1) < folderIds.length) {
3412 query.append(WHERE_OR);
3413 }
3414 }
3415
3416 query.append(StringPool.CLOSE_PARENTHESIS);
3417
3418 conjunctionable = true;
3419 }
3420
3421 String sql = query.toString();
3422
3423 Session session = null;
3424
3425 try {
3426 session = openSession();
3427
3428 Query q = session.createQuery(sql);
3429
3430 QueryPos qPos = QueryPos.getInstance(q);
3431
3432 qPos.add(groupId);
3433
3434 if (folderIds != null) {
3435 qPos.add(folderIds);
3436 }
3437
3438 count = (Long)q.uniqueResult();
3439 }
3440 catch (Exception e) {
3441 throw processException(e);
3442 }
3443 finally {
3444 if (count == null) {
3445 count = Long.valueOf(0);
3446 }
3447
3448 FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_F, finderArgs,
3449 count);
3450
3451 closeSession(session);
3452 }
3453 }
3454
3455 return count.intValue();
3456 }
3457
3458
3466 public int filterCountByG_F(long groupId, long folderId)
3467 throws SystemException {
3468 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
3469 return countByG_F(groupId, folderId);
3470 }
3471
3472 StringBundler query = new StringBundler(3);
3473
3474 query.append(_FILTER_SQL_COUNT_BOOKMARKSENTRY_WHERE);
3475
3476 query.append(_FINDER_COLUMN_G_F_GROUPID_2);
3477
3478 query.append(_FINDER_COLUMN_G_F_FOLDERID_2);
3479
3480 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3481 BookmarksEntry.class.getName(), _FILTER_COLUMN_PK,
3482 _FILTER_COLUMN_USERID, groupId);
3483
3484 Session session = null;
3485
3486 try {
3487 session = openSession();
3488
3489 SQLQuery q = session.createSQLQuery(sql);
3490
3491 q.addScalar(COUNT_COLUMN_NAME,
3492 com.liferay.portal.kernel.dao.orm.Type.LONG);
3493
3494 QueryPos qPos = QueryPos.getInstance(q);
3495
3496 qPos.add(groupId);
3497
3498 qPos.add(folderId);
3499
3500 Long count = (Long)q.uniqueResult();
3501
3502 return count.intValue();
3503 }
3504 catch (Exception e) {
3505 throw processException(e);
3506 }
3507 finally {
3508 closeSession(session);
3509 }
3510 }
3511
3512
3520 public int filterCountByG_F(long groupId, long[] folderIds)
3521 throws SystemException {
3522 if (!InlineSQLHelperUtil.isEnabled(groupId)) {
3523 return countByG_F(groupId, folderIds);
3524 }
3525
3526 StringBundler query = new StringBundler();
3527
3528 query.append(_FILTER_SQL_COUNT_BOOKMARKSENTRY_WHERE);
3529
3530 boolean conjunctionable = false;
3531
3532 if (conjunctionable) {
3533 query.append(WHERE_AND);
3534 }
3535
3536 query.append(_FINDER_COLUMN_G_F_GROUPID_5);
3537
3538 conjunctionable = true;
3539
3540 if ((folderIds == null) || (folderIds.length > 0)) {
3541 if (conjunctionable) {
3542 query.append(WHERE_AND);
3543 }
3544
3545 query.append(StringPool.OPEN_PARENTHESIS);
3546
3547 for (int i = 0; i < folderIds.length; i++) {
3548 query.append(_FINDER_COLUMN_G_F_FOLDERID_5);
3549
3550 if ((i + 1) < folderIds.length) {
3551 query.append(WHERE_OR);
3552 }
3553 }
3554
3555 query.append(StringPool.CLOSE_PARENTHESIS);
3556
3557 conjunctionable = true;
3558 }
3559
3560 String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3561 BookmarksEntry.class.getName(), _FILTER_COLUMN_PK,
3562 _FILTER_COLUMN_USERID, groupId);
3563
3564 Session session = null;
3565
3566 try {
3567 session = openSession();
3568
3569 SQLQuery q = session.createSQLQuery(sql);
3570
3571 q.addScalar(COUNT_COLUMN_NAME,
3572 com.liferay.portal.kernel.dao.orm.Type.LONG);
3573
3574 QueryPos qPos = QueryPos.getInstance(q);
3575
3576 qPos.add(groupId);
3577
3578 if (folderIds != null) {
3579 qPos.add(folderIds);
3580 }
3581
3582 Long count = (Long)q.uniqueResult();
3583
3584 return count.intValue();
3585 }
3586 catch (Exception e) {
3587 throw processException(e);
3588 }
3589 finally {
3590 closeSession(session);
3591 }
3592 }
3593
3594
3600 public int countAll() throws SystemException {
3601 Object[] finderArgs = new Object[0];
3602
3603 Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
3604 finderArgs, this);
3605
3606 if (count == null) {
3607 Session session = null;
3608
3609 try {
3610 session = openSession();
3611
3612 Query q = session.createQuery(_SQL_COUNT_BOOKMARKSENTRY);
3613
3614 count = (Long)q.uniqueResult();
3615 }
3616 catch (Exception e) {
3617 throw processException(e);
3618 }
3619 finally {
3620 if (count == null) {
3621 count = Long.valueOf(0);
3622 }
3623
3624 FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
3625 count);
3626
3627 closeSession(session);
3628 }
3629 }
3630
3631 return count.intValue();
3632 }
3633
3634
3637 public void afterPropertiesSet() {
3638 String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
3639 com.liferay.portal.util.PropsUtil.get(
3640 "value.object.listener.com.liferay.portlet.bookmarks.model.BookmarksEntry")));
3641
3642 if (listenerClassNames.length > 0) {
3643 try {
3644 List<ModelListener<BookmarksEntry>> listenersList = new ArrayList<ModelListener<BookmarksEntry>>();
3645
3646 for (String listenerClassName : listenerClassNames) {
3647 listenersList.add((ModelListener<BookmarksEntry>)InstanceFactory.newInstance(
3648 listenerClassName));
3649 }
3650
3651 listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
3652 }
3653 catch (Exception e) {
3654 _log.error(e);
3655 }
3656 }
3657 }
3658
3659 public void destroy() {
3660 EntityCacheUtil.removeCache(BookmarksEntryImpl.class.getName());
3661 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
3662 FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST);
3663 }
3664
3665 @BeanReference(type = BookmarksEntryPersistence.class)
3666 protected BookmarksEntryPersistence bookmarksEntryPersistence;
3667 @BeanReference(type = BookmarksFolderPersistence.class)
3668 protected BookmarksFolderPersistence bookmarksFolderPersistence;
3669 @BeanReference(type = ResourcePersistence.class)
3670 protected ResourcePersistence resourcePersistence;
3671 @BeanReference(type = UserPersistence.class)
3672 protected UserPersistence userPersistence;
3673 @BeanReference(type = AssetEntryPersistence.class)
3674 protected AssetEntryPersistence assetEntryPersistence;
3675 @BeanReference(type = AssetTagPersistence.class)
3676 protected AssetTagPersistence assetTagPersistence;
3677 @BeanReference(type = ExpandoValuePersistence.class)
3678 protected ExpandoValuePersistence expandoValuePersistence;
3679 private static final String _SQL_SELECT_BOOKMARKSENTRY = "SELECT bookmarksEntry FROM BookmarksEntry bookmarksEntry";
3680 private static final String _SQL_SELECT_BOOKMARKSENTRY_WHERE = "SELECT bookmarksEntry FROM BookmarksEntry bookmarksEntry WHERE ";
3681 private static final String _SQL_COUNT_BOOKMARKSENTRY = "SELECT COUNT(bookmarksEntry) FROM BookmarksEntry bookmarksEntry";
3682 private static final String _SQL_COUNT_BOOKMARKSENTRY_WHERE = "SELECT COUNT(bookmarksEntry) FROM BookmarksEntry bookmarksEntry WHERE ";
3683 private static final String _FINDER_COLUMN_UUID_UUID_1 = "bookmarksEntry.uuid IS NULL";
3684 private static final String _FINDER_COLUMN_UUID_UUID_2 = "bookmarksEntry.uuid = ?";
3685 private static final String _FINDER_COLUMN_UUID_UUID_3 = "(bookmarksEntry.uuid IS NULL OR bookmarksEntry.uuid = ?)";
3686 private static final String _FINDER_COLUMN_UUID_G_UUID_1 = "bookmarksEntry.uuid IS NULL AND ";
3687 private static final String _FINDER_COLUMN_UUID_G_UUID_2 = "bookmarksEntry.uuid = ? AND ";
3688 private static final String _FINDER_COLUMN_UUID_G_UUID_3 = "(bookmarksEntry.uuid IS NULL OR bookmarksEntry.uuid = ?) AND ";
3689 private static final String _FINDER_COLUMN_UUID_G_GROUPID_2 = "bookmarksEntry.groupId = ?";
3690 private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "bookmarksEntry.groupId = ?";
3691 private static final String _FINDER_COLUMN_G_U_GROUPID_2 = "bookmarksEntry.groupId = ? AND ";
3692 private static final String _FINDER_COLUMN_G_U_USERID_2 = "bookmarksEntry.userId = ?";
3693 private static final String _FINDER_COLUMN_G_F_GROUPID_2 = "bookmarksEntry.groupId = ? AND ";
3694 private static final String _FINDER_COLUMN_G_F_GROUPID_5 = "(" +
3695 _removeConjunction(_FINDER_COLUMN_G_F_GROUPID_2) + ")";
3696 private static final String _FINDER_COLUMN_G_F_FOLDERID_2 = "bookmarksEntry.folderId = ?";
3697 private static final String _FINDER_COLUMN_G_F_FOLDERID_5 = "(" +
3698 _removeConjunction(_FINDER_COLUMN_G_F_FOLDERID_2) + ")";
3699
3700 private static String _removeConjunction(String sql) {
3701 int pos = sql.indexOf(" AND ");
3702
3703 if (pos != -1) {
3704 sql = sql.substring(0, pos);
3705 }
3706
3707 return sql;
3708 }
3709
3710 private static final String _FILTER_SQL_SELECT_BOOKMARKSENTRY_WHERE = "SELECT DISTINCT {bookmarksEntry.*} FROM BookmarksEntry bookmarksEntry WHERE ";
3711 private static final String _FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_1 =
3712 "SELECT {BookmarksEntry.*} FROM (SELECT DISTINCT bookmarksEntry.entryId FROM BookmarksEntry bookmarksEntry WHERE ";
3713 private static final String _FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_2 =
3714 ") TEMP_TABLE INNER JOIN BookmarksEntry ON TEMP_TABLE.entryId = BookmarksEntry.entryId";
3715 private static final String _FILTER_SQL_COUNT_BOOKMARKSENTRY_WHERE = "SELECT COUNT(DISTINCT bookmarksEntry.entryId) AS COUNT_VALUE FROM BookmarksEntry bookmarksEntry WHERE ";
3716 private static final String _FILTER_COLUMN_PK = "bookmarksEntry.entryId";
3717 private static final String _FILTER_COLUMN_USERID = "bookmarksEntry.userId";
3718 private static final String _FILTER_ENTITY_ALIAS = "bookmarksEntry";
3719 private static final String _FILTER_ENTITY_TABLE = "BookmarksEntry";
3720 private static final String _ORDER_BY_ENTITY_ALIAS = "bookmarksEntry.";
3721 private static final String _ORDER_BY_ENTITY_TABLE = "BookmarksEntry.";
3722 private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No BookmarksEntry exists with the primary key ";
3723 private static final String _NO_SUCH_ENTITY_WITH_KEY = "No BookmarksEntry exists with the key {";
3724 private static Log _log = LogFactoryUtil.getLog(BookmarksEntryPersistenceImpl.class);
3725 }