001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
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    /**
061     * The persistence implementation for the bookmarks entry service.
062     *
063     * <p>
064     * Never modify or reference this class directly. Always use {@link BookmarksEntryUtil} to access the bookmarks entry persistence. Modify <code>service.xml</code> and rerun ServiceBuilder to regenerate this class.
065     * </p>
066     *
067     * <p>
068     * Caching information and settings can be found in <code>portal.properties</code>
069     * </p>
070     *
071     * @author Brian Wing Shun Chan
072     * @see BookmarksEntryPersistence
073     * @see BookmarksEntryUtil
074     * @generated
075     */
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            /**
149             * Caches the bookmarks entry in the entity cache if it is enabled.
150             *
151             * @param bookmarksEntry the bookmarks entry to cache
152             */
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            /**
165             * Caches the bookmarks entries in the entity cache if it is enabled.
166             *
167             * @param bookmarksEntries the bookmarks entries to cache
168             */
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            /**
181             * Clears the cache for all bookmarks entries.
182             *
183             * <p>
184             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
185             * </p>
186             */
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            /**
195             * Clears the cache for the bookmarks entry.
196             *
197             * <p>
198             * The {@link com.liferay.portal.kernel.dao.orm.EntityCache} and {@link com.liferay.portal.kernel.dao.orm.FinderCache} are both cleared by this method.
199             * </p>
200             */
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            /**
212             * Creates a new bookmarks entry with the primary key. Does not add the bookmarks entry to the database.
213             *
214             * @param entryId the primary key for the new bookmarks entry
215             * @return the new bookmarks entry
216             */
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            /**
231             * Removes the bookmarks entry with the primary key from the database. Also notifies the appropriate model listeners.
232             *
233             * @param primaryKey the primary key of the bookmarks entry to remove
234             * @return the bookmarks entry that was removed
235             * @throws com.liferay.portal.NoSuchModelException if a bookmarks entry with the primary key could not be found
236             * @throws SystemException if a system exception occurred
237             */
238            public BookmarksEntry remove(Serializable primaryKey)
239                    throws NoSuchModelException, SystemException {
240                    return remove(((Long)primaryKey).longValue());
241            }
242    
243            /**
244             * Removes the bookmarks entry with the primary key from the database. Also notifies the appropriate model listeners.
245             *
246             * @param entryId the primary key of the bookmarks entry to remove
247             * @return the bookmarks entry that was removed
248             * @throws com.liferay.portlet.bookmarks.NoSuchEntryException if a bookmarks entry with the primary key could not be found
249             * @throws SystemException if a system exception occurred
250             */
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.getOriginalUuid(),
308                                    new Long(bookmarksEntryModelImpl.getOriginalGroupId())
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            /**
407             * Finds the bookmarks entry with the primary key or throws a {@link com.liferay.portal.NoSuchModelException} if it could not be found.
408             *
409             * @param primaryKey the primary key of the bookmarks entry to find
410             * @return the bookmarks entry
411             * @throws com.liferay.portal.NoSuchModelException if a bookmarks entry with the primary key could not be found
412             * @throws SystemException if a system exception occurred
413             */
414            public BookmarksEntry findByPrimaryKey(Serializable primaryKey)
415                    throws NoSuchModelException, SystemException {
416                    return findByPrimaryKey(((Long)primaryKey).longValue());
417            }
418    
419            /**
420             * Finds the bookmarks entry with the primary key or throws a {@link com.liferay.portlet.bookmarks.NoSuchEntryException} if it could not be found.
421             *
422             * @param entryId the primary key of the bookmarks entry to find
423             * @return the bookmarks entry
424             * @throws com.liferay.portlet.bookmarks.NoSuchEntryException if a bookmarks entry with the primary key could not be found
425             * @throws SystemException if a system exception occurred
426             */
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            /**
444             * Finds the bookmarks entry with the primary key or returns <code>null</code> if it could not be found.
445             *
446             * @param primaryKey the primary key of the bookmarks entry to find
447             * @return the bookmarks entry, or <code>null</code> if a bookmarks entry with the primary key could not be found
448             * @throws SystemException if a system exception occurred
449             */
450            public BookmarksEntry fetchByPrimaryKey(Serializable primaryKey)
451                    throws SystemException {
452                    return fetchByPrimaryKey(((Long)primaryKey).longValue());
453            }
454    
455            /**
456             * Finds the bookmarks entry with the primary key or returns <code>null</code> if it could not be found.
457             *
458             * @param entryId the primary key of the bookmarks entry to find
459             * @return the bookmarks entry, or <code>null</code> if a bookmarks entry with the primary key could not be found
460             * @throws SystemException if a system exception occurred
461             */
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            /**
492             * Finds all the bookmarks entries where uuid = &#63;.
493             *
494             * @param uuid the uuid to search with
495             * @return the matching bookmarks entries
496             * @throws SystemException if a system exception occurred
497             */
498            public List<BookmarksEntry> findByUuid(String uuid)
499                    throws SystemException {
500                    return findByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
501            }
502    
503            /**
504             * Finds a range of all the bookmarks entries where uuid = &#63;.
505             *
506             * <p>
507             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
508             * </p>
509             *
510             * @param uuid the uuid to search with
511             * @param start the lower bound of the range of bookmarks entries to return
512             * @param end the upper bound of the range of bookmarks entries to return (not inclusive)
513             * @return the range of matching bookmarks entries
514             * @throws SystemException if a system exception occurred
515             */
516            public List<BookmarksEntry> findByUuid(String uuid, int start, int end)
517                    throws SystemException {
518                    return findByUuid(uuid, start, end, null);
519            }
520    
521            /**
522             * Finds an ordered range of all the bookmarks entries where uuid = &#63;.
523             *
524             * <p>
525             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
526             * </p>
527             *
528             * @param uuid the uuid to search with
529             * @param start the lower bound of the range of bookmarks entries to return
530             * @param end the upper bound of the range of bookmarks entries to return (not inclusive)
531             * @param orderByComparator the comparator to order the results by
532             * @return the ordered range of matching bookmarks entries
533             * @throws SystemException if a system exception occurred
534             */
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                            Session session = null;
549    
550                            try {
551                                    session = openSession();
552    
553                                    StringBundler query = null;
554    
555                                    if (orderByComparator != null) {
556                                            query = new StringBundler(3 +
557                                                            (orderByComparator.getOrderByFields().length * 3));
558                                    }
559                                    else {
560                                            query = new StringBundler(3);
561                                    }
562    
563                                    query.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE);
564    
565                                    if (uuid == null) {
566                                            query.append(_FINDER_COLUMN_UUID_UUID_1);
567                                    }
568                                    else {
569                                            if (uuid.equals(StringPool.BLANK)) {
570                                                    query.append(_FINDER_COLUMN_UUID_UUID_3);
571                                            }
572                                            else {
573                                                    query.append(_FINDER_COLUMN_UUID_UUID_2);
574                                            }
575                                    }
576    
577                                    if (orderByComparator != null) {
578                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
579                                                    orderByComparator);
580                                    }
581    
582                                    else {
583                                            query.append(BookmarksEntryModelImpl.ORDER_BY_JPQL);
584                                    }
585    
586                                    String sql = query.toString();
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                                            list = new ArrayList<BookmarksEntry>();
605                                    }
606    
607                                    cacheResult(list);
608    
609                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_UUID, finderArgs,
610                                            list);
611    
612                                    closeSession(session);
613                            }
614                    }
615    
616                    return list;
617            }
618    
619            /**
620             * Finds the first bookmarks entry in the ordered set where uuid = &#63;.
621             *
622             * <p>
623             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
624             * </p>
625             *
626             * @param uuid the uuid to search with
627             * @param orderByComparator the comparator to order the set by
628             * @return the first matching bookmarks entry
629             * @throws com.liferay.portlet.bookmarks.NoSuchEntryException if a matching bookmarks entry could not be found
630             * @throws SystemException if a system exception occurred
631             */
632            public BookmarksEntry findByUuid_First(String uuid,
633                    OrderByComparator orderByComparator)
634                    throws NoSuchEntryException, SystemException {
635                    List<BookmarksEntry> list = findByUuid(uuid, 0, 1, orderByComparator);
636    
637                    if (list.isEmpty()) {
638                            StringBundler msg = new StringBundler(4);
639    
640                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
641    
642                            msg.append("uuid=");
643                            msg.append(uuid);
644    
645                            msg.append(StringPool.CLOSE_CURLY_BRACE);
646    
647                            throw new NoSuchEntryException(msg.toString());
648                    }
649                    else {
650                            return list.get(0);
651                    }
652            }
653    
654            /**
655             * Finds the last bookmarks entry in the ordered set where uuid = &#63;.
656             *
657             * <p>
658             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
659             * </p>
660             *
661             * @param uuid the uuid to search with
662             * @param orderByComparator the comparator to order the set by
663             * @return the last matching bookmarks entry
664             * @throws com.liferay.portlet.bookmarks.NoSuchEntryException if a matching bookmarks entry could not be found
665             * @throws SystemException if a system exception occurred
666             */
667            public BookmarksEntry findByUuid_Last(String uuid,
668                    OrderByComparator orderByComparator)
669                    throws NoSuchEntryException, SystemException {
670                    int count = countByUuid(uuid);
671    
672                    List<BookmarksEntry> list = findByUuid(uuid, count - 1, count,
673                                    orderByComparator);
674    
675                    if (list.isEmpty()) {
676                            StringBundler msg = new StringBundler(4);
677    
678                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
679    
680                            msg.append("uuid=");
681                            msg.append(uuid);
682    
683                            msg.append(StringPool.CLOSE_CURLY_BRACE);
684    
685                            throw new NoSuchEntryException(msg.toString());
686                    }
687                    else {
688                            return list.get(0);
689                    }
690            }
691    
692            /**
693             * Finds the bookmarks entries before and after the current bookmarks entry in the ordered set where uuid = &#63;.
694             *
695             * <p>
696             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
697             * </p>
698             *
699             * @param entryId the primary key of the current bookmarks entry
700             * @param uuid the uuid to search with
701             * @param orderByComparator the comparator to order the set by
702             * @return the previous, current, and next bookmarks entry
703             * @throws com.liferay.portlet.bookmarks.NoSuchEntryException if a bookmarks entry with the primary key could not be found
704             * @throws SystemException if a system exception occurred
705             */
706            public BookmarksEntry[] findByUuid_PrevAndNext(long entryId, String uuid,
707                    OrderByComparator orderByComparator)
708                    throws NoSuchEntryException, SystemException {
709                    BookmarksEntry bookmarksEntry = findByPrimaryKey(entryId);
710    
711                    Session session = null;
712    
713                    try {
714                            session = openSession();
715    
716                            BookmarksEntry[] array = new BookmarksEntryImpl[3];
717    
718                            array[0] = getByUuid_PrevAndNext(session, bookmarksEntry, uuid,
719                                            orderByComparator, true);
720    
721                            array[1] = bookmarksEntry;
722    
723                            array[2] = getByUuid_PrevAndNext(session, bookmarksEntry, uuid,
724                                            orderByComparator, false);
725    
726                            return array;
727                    }
728                    catch (Exception e) {
729                            throw processException(e);
730                    }
731                    finally {
732                            closeSession(session);
733                    }
734            }
735    
736            protected BookmarksEntry getByUuid_PrevAndNext(Session session,
737                    BookmarksEntry bookmarksEntry, String uuid,
738                    OrderByComparator orderByComparator, boolean previous) {
739                    StringBundler query = null;
740    
741                    if (orderByComparator != null) {
742                            query = new StringBundler(6 +
743                                            (orderByComparator.getOrderByFields().length * 6));
744                    }
745                    else {
746                            query = new StringBundler(3);
747                    }
748    
749                    query.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE);
750    
751                    if (uuid == null) {
752                            query.append(_FINDER_COLUMN_UUID_UUID_1);
753                    }
754                    else {
755                            if (uuid.equals(StringPool.BLANK)) {
756                                    query.append(_FINDER_COLUMN_UUID_UUID_3);
757                            }
758                            else {
759                                    query.append(_FINDER_COLUMN_UUID_UUID_2);
760                            }
761                    }
762    
763                    if (orderByComparator != null) {
764                            String[] orderByFields = orderByComparator.getOrderByFields();
765    
766                            if (orderByFields.length > 0) {
767                                    query.append(WHERE_AND);
768                            }
769    
770                            for (int i = 0; i < orderByFields.length; i++) {
771                                    query.append(_ORDER_BY_ENTITY_ALIAS);
772                                    query.append(orderByFields[i]);
773    
774                                    if ((i + 1) < orderByFields.length) {
775                                            if (orderByComparator.isAscending() ^ previous) {
776                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
777                                            }
778                                            else {
779                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
780                                            }
781                                    }
782                                    else {
783                                            if (orderByComparator.isAscending() ^ previous) {
784                                                    query.append(WHERE_GREATER_THAN);
785                                            }
786                                            else {
787                                                    query.append(WHERE_LESSER_THAN);
788                                            }
789                                    }
790                            }
791    
792                            query.append(ORDER_BY_CLAUSE);
793    
794                            for (int i = 0; i < orderByFields.length; i++) {
795                                    query.append(_ORDER_BY_ENTITY_ALIAS);
796                                    query.append(orderByFields[i]);
797    
798                                    if ((i + 1) < orderByFields.length) {
799                                            if (orderByComparator.isAscending() ^ previous) {
800                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
801                                            }
802                                            else {
803                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
804                                            }
805                                    }
806                                    else {
807                                            if (orderByComparator.isAscending() ^ previous) {
808                                                    query.append(ORDER_BY_ASC);
809                                            }
810                                            else {
811                                                    query.append(ORDER_BY_DESC);
812                                            }
813                                    }
814                            }
815                    }
816    
817                    else {
818                            query.append(BookmarksEntryModelImpl.ORDER_BY_JPQL);
819                    }
820    
821                    String sql = query.toString();
822    
823                    Query q = session.createQuery(sql);
824    
825                    q.setFirstResult(0);
826                    q.setMaxResults(2);
827    
828                    QueryPos qPos = QueryPos.getInstance(q);
829    
830                    if (uuid != null) {
831                            qPos.add(uuid);
832                    }
833    
834                    if (orderByComparator != null) {
835                            Object[] values = orderByComparator.getOrderByValues(bookmarksEntry);
836    
837                            for (Object value : values) {
838                                    qPos.add(value);
839                            }
840                    }
841    
842                    List<BookmarksEntry> list = q.list();
843    
844                    if (list.size() == 2) {
845                            return list.get(1);
846                    }
847                    else {
848                            return null;
849                    }
850            }
851    
852            /**
853             * Finds the bookmarks entry where uuid = &#63; and groupId = &#63; or throws a {@link com.liferay.portlet.bookmarks.NoSuchEntryException} if it could not be found.
854             *
855             * @param uuid the uuid to search with
856             * @param groupId the group id to search with
857             * @return the matching bookmarks entry
858             * @throws com.liferay.portlet.bookmarks.NoSuchEntryException if a matching bookmarks entry could not be found
859             * @throws SystemException if a system exception occurred
860             */
861            public BookmarksEntry findByUUID_G(String uuid, long groupId)
862                    throws NoSuchEntryException, SystemException {
863                    BookmarksEntry bookmarksEntry = fetchByUUID_G(uuid, groupId);
864    
865                    if (bookmarksEntry == null) {
866                            StringBundler msg = new StringBundler(6);
867    
868                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
869    
870                            msg.append("uuid=");
871                            msg.append(uuid);
872    
873                            msg.append(", groupId=");
874                            msg.append(groupId);
875    
876                            msg.append(StringPool.CLOSE_CURLY_BRACE);
877    
878                            if (_log.isWarnEnabled()) {
879                                    _log.warn(msg.toString());
880                            }
881    
882                            throw new NoSuchEntryException(msg.toString());
883                    }
884    
885                    return bookmarksEntry;
886            }
887    
888            /**
889             * Finds the bookmarks entry where uuid = &#63; and groupId = &#63; or returns <code>null</code> if it could not be found. Uses the finder cache.
890             *
891             * @param uuid the uuid to search with
892             * @param groupId the group id to search with
893             * @return the matching bookmarks entry, or <code>null</code> if a matching bookmarks entry could not be found
894             * @throws SystemException if a system exception occurred
895             */
896            public BookmarksEntry fetchByUUID_G(String uuid, long groupId)
897                    throws SystemException {
898                    return fetchByUUID_G(uuid, groupId, true);
899            }
900    
901            /**
902             * Finds the bookmarks entry where uuid = &#63; and groupId = &#63; or returns <code>null</code> if it could not be found, optionally using the finder cache.
903             *
904             * @param uuid the uuid to search with
905             * @param groupId the group id to search with
906             * @return the matching bookmarks entry, or <code>null</code> if a matching bookmarks entry could not be found
907             * @throws SystemException if a system exception occurred
908             */
909            public BookmarksEntry fetchByUUID_G(String uuid, long groupId,
910                    boolean retrieveFromCache) throws SystemException {
911                    Object[] finderArgs = new Object[] { uuid, groupId };
912    
913                    Object result = null;
914    
915                    if (retrieveFromCache) {
916                            result = FinderCacheUtil.getResult(FINDER_PATH_FETCH_BY_UUID_G,
917                                            finderArgs, this);
918                    }
919    
920                    if (result == null) {
921                            Session session = null;
922    
923                            try {
924                                    session = openSession();
925    
926                                    StringBundler query = new StringBundler(4);
927    
928                                    query.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE);
929    
930                                    if (uuid == null) {
931                                            query.append(_FINDER_COLUMN_UUID_G_UUID_1);
932                                    }
933                                    else {
934                                            if (uuid.equals(StringPool.BLANK)) {
935                                                    query.append(_FINDER_COLUMN_UUID_G_UUID_3);
936                                            }
937                                            else {
938                                                    query.append(_FINDER_COLUMN_UUID_G_UUID_2);
939                                            }
940                                    }
941    
942                                    query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
943    
944                                    query.append(BookmarksEntryModelImpl.ORDER_BY_JPQL);
945    
946                                    String sql = query.toString();
947    
948                                    Query q = session.createQuery(sql);
949    
950                                    QueryPos qPos = QueryPos.getInstance(q);
951    
952                                    if (uuid != null) {
953                                            qPos.add(uuid);
954                                    }
955    
956                                    qPos.add(groupId);
957    
958                                    List<BookmarksEntry> list = q.list();
959    
960                                    result = list;
961    
962                                    BookmarksEntry bookmarksEntry = null;
963    
964                                    if (list.isEmpty()) {
965                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
966                                                    finderArgs, list);
967                                    }
968                                    else {
969                                            bookmarksEntry = list.get(0);
970    
971                                            cacheResult(bookmarksEntry);
972    
973                                            if ((bookmarksEntry.getUuid() == null) ||
974                                                            !bookmarksEntry.getUuid().equals(uuid) ||
975                                                            (bookmarksEntry.getGroupId() != groupId)) {
976                                                    FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
977                                                            finderArgs, bookmarksEntry);
978                                            }
979                                    }
980    
981                                    return bookmarksEntry;
982                            }
983                            catch (Exception e) {
984                                    throw processException(e);
985                            }
986                            finally {
987                                    if (result == null) {
988                                            FinderCacheUtil.putResult(FINDER_PATH_FETCH_BY_UUID_G,
989                                                    finderArgs, new ArrayList<BookmarksEntry>());
990                                    }
991    
992                                    closeSession(session);
993                            }
994                    }
995                    else {
996                            if (result instanceof List<?>) {
997                                    return null;
998                            }
999                            else {
1000                                    return (BookmarksEntry)result;
1001                            }
1002                    }
1003            }
1004    
1005            /**
1006             * Finds all the bookmarks entries where groupId = &#63;.
1007             *
1008             * @param groupId the group id to search with
1009             * @return the matching bookmarks entries
1010             * @throws SystemException if a system exception occurred
1011             */
1012            public List<BookmarksEntry> findByGroupId(long groupId)
1013                    throws SystemException {
1014                    return findByGroupId(groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
1015            }
1016    
1017            /**
1018             * Finds a range of all the bookmarks entries where groupId = &#63;.
1019             *
1020             * <p>
1021             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1022             * </p>
1023             *
1024             * @param groupId the group id to search with
1025             * @param start the lower bound of the range of bookmarks entries to return
1026             * @param end the upper bound of the range of bookmarks entries to return (not inclusive)
1027             * @return the range of matching bookmarks entries
1028             * @throws SystemException if a system exception occurred
1029             */
1030            public List<BookmarksEntry> findByGroupId(long groupId, int start, int end)
1031                    throws SystemException {
1032                    return findByGroupId(groupId, start, end, null);
1033            }
1034    
1035            /**
1036             * Finds an ordered range of all the bookmarks entries where groupId = &#63;.
1037             *
1038             * <p>
1039             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1040             * </p>
1041             *
1042             * @param groupId the group id to search with
1043             * @param start the lower bound of the range of bookmarks entries to return
1044             * @param end the upper bound of the range of bookmarks entries to return (not inclusive)
1045             * @param orderByComparator the comparator to order the results by
1046             * @return the ordered range of matching bookmarks entries
1047             * @throws SystemException if a system exception occurred
1048             */
1049            public List<BookmarksEntry> findByGroupId(long groupId, int start, int end,
1050                    OrderByComparator orderByComparator) throws SystemException {
1051                    Object[] finderArgs = new Object[] {
1052                                    groupId,
1053                                    
1054                                    String.valueOf(start), String.valueOf(end),
1055                                    String.valueOf(orderByComparator)
1056                            };
1057    
1058                    List<BookmarksEntry> list = (List<BookmarksEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_GROUPID,
1059                                    finderArgs, this);
1060    
1061                    if (list == null) {
1062                            Session session = null;
1063    
1064                            try {
1065                                    session = openSession();
1066    
1067                                    StringBundler query = null;
1068    
1069                                    if (orderByComparator != null) {
1070                                            query = new StringBundler(3 +
1071                                                            (orderByComparator.getOrderByFields().length * 3));
1072                                    }
1073                                    else {
1074                                            query = new StringBundler(3);
1075                                    }
1076    
1077                                    query.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE);
1078    
1079                                    query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1080    
1081                                    if (orderByComparator != null) {
1082                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1083                                                    orderByComparator);
1084                                    }
1085    
1086                                    else {
1087                                            query.append(BookmarksEntryModelImpl.ORDER_BY_JPQL);
1088                                    }
1089    
1090                                    String sql = query.toString();
1091    
1092                                    Query q = session.createQuery(sql);
1093    
1094                                    QueryPos qPos = QueryPos.getInstance(q);
1095    
1096                                    qPos.add(groupId);
1097    
1098                                    list = (List<BookmarksEntry>)QueryUtil.list(q, getDialect(),
1099                                                    start, end);
1100                            }
1101                            catch (Exception e) {
1102                                    throw processException(e);
1103                            }
1104                            finally {
1105                                    if (list == null) {
1106                                            list = new ArrayList<BookmarksEntry>();
1107                                    }
1108    
1109                                    cacheResult(list);
1110    
1111                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_GROUPID,
1112                                            finderArgs, list);
1113    
1114                                    closeSession(session);
1115                            }
1116                    }
1117    
1118                    return list;
1119            }
1120    
1121            /**
1122             * Finds the first bookmarks entry in the ordered set where groupId = &#63;.
1123             *
1124             * <p>
1125             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1126             * </p>
1127             *
1128             * @param groupId the group id to search with
1129             * @param orderByComparator the comparator to order the set by
1130             * @return the first matching bookmarks entry
1131             * @throws com.liferay.portlet.bookmarks.NoSuchEntryException if a matching bookmarks entry could not be found
1132             * @throws SystemException if a system exception occurred
1133             */
1134            public BookmarksEntry findByGroupId_First(long groupId,
1135                    OrderByComparator orderByComparator)
1136                    throws NoSuchEntryException, SystemException {
1137                    List<BookmarksEntry> list = findByGroupId(groupId, 0, 1,
1138                                    orderByComparator);
1139    
1140                    if (list.isEmpty()) {
1141                            StringBundler msg = new StringBundler(4);
1142    
1143                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1144    
1145                            msg.append("groupId=");
1146                            msg.append(groupId);
1147    
1148                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1149    
1150                            throw new NoSuchEntryException(msg.toString());
1151                    }
1152                    else {
1153                            return list.get(0);
1154                    }
1155            }
1156    
1157            /**
1158             * Finds the last bookmarks entry in the ordered set where groupId = &#63;.
1159             *
1160             * <p>
1161             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1162             * </p>
1163             *
1164             * @param groupId the group id to search with
1165             * @param orderByComparator the comparator to order the set by
1166             * @return the last matching bookmarks entry
1167             * @throws com.liferay.portlet.bookmarks.NoSuchEntryException if a matching bookmarks entry could not be found
1168             * @throws SystemException if a system exception occurred
1169             */
1170            public BookmarksEntry findByGroupId_Last(long groupId,
1171                    OrderByComparator orderByComparator)
1172                    throws NoSuchEntryException, SystemException {
1173                    int count = countByGroupId(groupId);
1174    
1175                    List<BookmarksEntry> list = findByGroupId(groupId, count - 1, count,
1176                                    orderByComparator);
1177    
1178                    if (list.isEmpty()) {
1179                            StringBundler msg = new StringBundler(4);
1180    
1181                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1182    
1183                            msg.append("groupId=");
1184                            msg.append(groupId);
1185    
1186                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1187    
1188                            throw new NoSuchEntryException(msg.toString());
1189                    }
1190                    else {
1191                            return list.get(0);
1192                    }
1193            }
1194    
1195            /**
1196             * Finds the bookmarks entries before and after the current bookmarks entry in the ordered set where groupId = &#63;.
1197             *
1198             * <p>
1199             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1200             * </p>
1201             *
1202             * @param entryId the primary key of the current bookmarks entry
1203             * @param groupId the group id to search with
1204             * @param orderByComparator the comparator to order the set by
1205             * @return the previous, current, and next bookmarks entry
1206             * @throws com.liferay.portlet.bookmarks.NoSuchEntryException if a bookmarks entry with the primary key could not be found
1207             * @throws SystemException if a system exception occurred
1208             */
1209            public BookmarksEntry[] findByGroupId_PrevAndNext(long entryId,
1210                    long groupId, OrderByComparator orderByComparator)
1211                    throws NoSuchEntryException, SystemException {
1212                    BookmarksEntry bookmarksEntry = findByPrimaryKey(entryId);
1213    
1214                    Session session = null;
1215    
1216                    try {
1217                            session = openSession();
1218    
1219                            BookmarksEntry[] array = new BookmarksEntryImpl[3];
1220    
1221                            array[0] = getByGroupId_PrevAndNext(session, bookmarksEntry,
1222                                            groupId, orderByComparator, true);
1223    
1224                            array[1] = bookmarksEntry;
1225    
1226                            array[2] = getByGroupId_PrevAndNext(session, bookmarksEntry,
1227                                            groupId, orderByComparator, false);
1228    
1229                            return array;
1230                    }
1231                    catch (Exception e) {
1232                            throw processException(e);
1233                    }
1234                    finally {
1235                            closeSession(session);
1236                    }
1237            }
1238    
1239            protected BookmarksEntry getByGroupId_PrevAndNext(Session session,
1240                    BookmarksEntry bookmarksEntry, long groupId,
1241                    OrderByComparator orderByComparator, boolean previous) {
1242                    StringBundler query = null;
1243    
1244                    if (orderByComparator != null) {
1245                            query = new StringBundler(6 +
1246                                            (orderByComparator.getOrderByFields().length * 6));
1247                    }
1248                    else {
1249                            query = new StringBundler(3);
1250                    }
1251    
1252                    query.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE);
1253    
1254                    query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1255    
1256                    if (orderByComparator != null) {
1257                            String[] orderByFields = orderByComparator.getOrderByFields();
1258    
1259                            if (orderByFields.length > 0) {
1260                                    query.append(WHERE_AND);
1261                            }
1262    
1263                            for (int i = 0; i < orderByFields.length; i++) {
1264                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1265                                    query.append(orderByFields[i]);
1266    
1267                                    if ((i + 1) < orderByFields.length) {
1268                                            if (orderByComparator.isAscending() ^ previous) {
1269                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1270                                            }
1271                                            else {
1272                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1273                                            }
1274                                    }
1275                                    else {
1276                                            if (orderByComparator.isAscending() ^ previous) {
1277                                                    query.append(WHERE_GREATER_THAN);
1278                                            }
1279                                            else {
1280                                                    query.append(WHERE_LESSER_THAN);
1281                                            }
1282                                    }
1283                            }
1284    
1285                            query.append(ORDER_BY_CLAUSE);
1286    
1287                            for (int i = 0; i < orderByFields.length; i++) {
1288                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1289                                    query.append(orderByFields[i]);
1290    
1291                                    if ((i + 1) < orderByFields.length) {
1292                                            if (orderByComparator.isAscending() ^ previous) {
1293                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1294                                            }
1295                                            else {
1296                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1297                                            }
1298                                    }
1299                                    else {
1300                                            if (orderByComparator.isAscending() ^ previous) {
1301                                                    query.append(ORDER_BY_ASC);
1302                                            }
1303                                            else {
1304                                                    query.append(ORDER_BY_DESC);
1305                                            }
1306                                    }
1307                            }
1308                    }
1309    
1310                    else {
1311                            query.append(BookmarksEntryModelImpl.ORDER_BY_JPQL);
1312                    }
1313    
1314                    String sql = query.toString();
1315    
1316                    Query q = session.createQuery(sql);
1317    
1318                    q.setFirstResult(0);
1319                    q.setMaxResults(2);
1320    
1321                    QueryPos qPos = QueryPos.getInstance(q);
1322    
1323                    qPos.add(groupId);
1324    
1325                    if (orderByComparator != null) {
1326                            Object[] values = orderByComparator.getOrderByValues(bookmarksEntry);
1327    
1328                            for (Object value : values) {
1329                                    qPos.add(value);
1330                            }
1331                    }
1332    
1333                    List<BookmarksEntry> list = q.list();
1334    
1335                    if (list.size() == 2) {
1336                            return list.get(1);
1337                    }
1338                    else {
1339                            return null;
1340                    }
1341            }
1342    
1343            /**
1344             * Filters by the user's permissions and finds all the bookmarks entries where groupId = &#63;.
1345             *
1346             * @param groupId the group id to search with
1347             * @return the matching bookmarks entries that the user has permission to view
1348             * @throws SystemException if a system exception occurred
1349             */
1350            public List<BookmarksEntry> filterFindByGroupId(long groupId)
1351                    throws SystemException {
1352                    return filterFindByGroupId(groupId, QueryUtil.ALL_POS,
1353                            QueryUtil.ALL_POS, null);
1354            }
1355    
1356            /**
1357             * Filters by the user's permissions and finds a range of all the bookmarks entries where groupId = &#63;.
1358             *
1359             * <p>
1360             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1361             * </p>
1362             *
1363             * @param groupId the group id to search with
1364             * @param start the lower bound of the range of bookmarks entries to return
1365             * @param end the upper bound of the range of bookmarks entries to return (not inclusive)
1366             * @return the range of matching bookmarks entries that the user has permission to view
1367             * @throws SystemException if a system exception occurred
1368             */
1369            public List<BookmarksEntry> filterFindByGroupId(long groupId, int start,
1370                    int end) throws SystemException {
1371                    return filterFindByGroupId(groupId, start, end, null);
1372            }
1373    
1374            /**
1375             * Filters by the user's permissions and finds an ordered range of all the bookmarks entries where groupId = &#63;.
1376             *
1377             * <p>
1378             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1379             * </p>
1380             *
1381             * @param groupId the group id to search with
1382             * @param start the lower bound of the range of bookmarks entries to return
1383             * @param end the upper bound of the range of bookmarks entries to return (not inclusive)
1384             * @param orderByComparator the comparator to order the results by
1385             * @return the ordered range of matching bookmarks entries that the user has permission to view
1386             * @throws SystemException if a system exception occurred
1387             */
1388            public List<BookmarksEntry> filterFindByGroupId(long groupId, int start,
1389                    int end, OrderByComparator orderByComparator) throws SystemException {
1390                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1391                            return findByGroupId(groupId, start, end, orderByComparator);
1392                    }
1393    
1394                    Session session = null;
1395    
1396                    try {
1397                            session = openSession();
1398    
1399                            StringBundler query = null;
1400    
1401                            if (orderByComparator != null) {
1402                                    query = new StringBundler(3 +
1403                                                    (orderByComparator.getOrderByFields().length * 3));
1404                            }
1405                            else {
1406                                    query = new StringBundler(3);
1407                            }
1408    
1409                            if (getDB().isSupportsInlineDistinct()) {
1410                                    query.append(_FILTER_SQL_SELECT_BOOKMARKSENTRY_WHERE);
1411                            }
1412                            else {
1413                                    query.append(_FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE);
1414                            }
1415    
1416                            query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
1417    
1418                            if (orderByComparator != null) {
1419                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1420                                            orderByComparator);
1421                            }
1422    
1423                            else {
1424                                    query.append(BookmarksEntryModelImpl.ORDER_BY_JPQL);
1425                            }
1426    
1427                            String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1428                                            BookmarksEntry.class.getName(), _FILTER_COLUMN_PK,
1429                                            _FILTER_COLUMN_USERID, groupId);
1430    
1431                            SQLQuery q = session.createSQLQuery(sql);
1432    
1433                            q.addEntity(_FILTER_ENTITY_ALIAS, BookmarksEntryImpl.class);
1434    
1435                            QueryPos qPos = QueryPos.getInstance(q);
1436    
1437                            qPos.add(groupId);
1438    
1439                            return (List<BookmarksEntry>)QueryUtil.list(q, getDialect(), start,
1440                                    end);
1441                    }
1442                    catch (Exception e) {
1443                            throw processException(e);
1444                    }
1445                    finally {
1446                            closeSession(session);
1447                    }
1448            }
1449    
1450            /**
1451             * Finds all the bookmarks entries where groupId = &#63; and userId = &#63;.
1452             *
1453             * @param groupId the group id to search with
1454             * @param userId the user id to search with
1455             * @return the matching bookmarks entries
1456             * @throws SystemException if a system exception occurred
1457             */
1458            public List<BookmarksEntry> findByG_U(long groupId, long userId)
1459                    throws SystemException {
1460                    return findByG_U(groupId, userId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
1461                            null);
1462            }
1463    
1464            /**
1465             * Finds a range of all the bookmarks entries where groupId = &#63; and userId = &#63;.
1466             *
1467             * <p>
1468             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1469             * </p>
1470             *
1471             * @param groupId the group id to search with
1472             * @param userId the user id to search with
1473             * @param start the lower bound of the range of bookmarks entries to return
1474             * @param end the upper bound of the range of bookmarks entries to return (not inclusive)
1475             * @return the range of matching bookmarks entries
1476             * @throws SystemException if a system exception occurred
1477             */
1478            public List<BookmarksEntry> findByG_U(long groupId, long userId, int start,
1479                    int end) throws SystemException {
1480                    return findByG_U(groupId, userId, start, end, null);
1481            }
1482    
1483            /**
1484             * Finds an ordered range of all the bookmarks entries where groupId = &#63; and userId = &#63;.
1485             *
1486             * <p>
1487             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1488             * </p>
1489             *
1490             * @param groupId the group id to search with
1491             * @param userId the user id to search with
1492             * @param start the lower bound of the range of bookmarks entries to return
1493             * @param end the upper bound of the range of bookmarks entries to return (not inclusive)
1494             * @param orderByComparator the comparator to order the results by
1495             * @return the ordered range of matching bookmarks entries
1496             * @throws SystemException if a system exception occurred
1497             */
1498            public List<BookmarksEntry> findByG_U(long groupId, long userId, int start,
1499                    int end, OrderByComparator orderByComparator) throws SystemException {
1500                    Object[] finderArgs = new Object[] {
1501                                    groupId, userId,
1502                                    
1503                                    String.valueOf(start), String.valueOf(end),
1504                                    String.valueOf(orderByComparator)
1505                            };
1506    
1507                    List<BookmarksEntry> list = (List<BookmarksEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_U,
1508                                    finderArgs, this);
1509    
1510                    if (list == null) {
1511                            Session session = null;
1512    
1513                            try {
1514                                    session = openSession();
1515    
1516                                    StringBundler query = null;
1517    
1518                                    if (orderByComparator != null) {
1519                                            query = new StringBundler(4 +
1520                                                            (orderByComparator.getOrderByFields().length * 3));
1521                                    }
1522                                    else {
1523                                            query = new StringBundler(4);
1524                                    }
1525    
1526                                    query.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE);
1527    
1528                                    query.append(_FINDER_COLUMN_G_U_GROUPID_2);
1529    
1530                                    query.append(_FINDER_COLUMN_G_U_USERID_2);
1531    
1532                                    if (orderByComparator != null) {
1533                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1534                                                    orderByComparator);
1535                                    }
1536    
1537                                    else {
1538                                            query.append(BookmarksEntryModelImpl.ORDER_BY_JPQL);
1539                                    }
1540    
1541                                    String sql = query.toString();
1542    
1543                                    Query q = session.createQuery(sql);
1544    
1545                                    QueryPos qPos = QueryPos.getInstance(q);
1546    
1547                                    qPos.add(groupId);
1548    
1549                                    qPos.add(userId);
1550    
1551                                    list = (List<BookmarksEntry>)QueryUtil.list(q, getDialect(),
1552                                                    start, end);
1553                            }
1554                            catch (Exception e) {
1555                                    throw processException(e);
1556                            }
1557                            finally {
1558                                    if (list == null) {
1559                                            list = new ArrayList<BookmarksEntry>();
1560                                    }
1561    
1562                                    cacheResult(list);
1563    
1564                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_U, finderArgs,
1565                                            list);
1566    
1567                                    closeSession(session);
1568                            }
1569                    }
1570    
1571                    return list;
1572            }
1573    
1574            /**
1575             * Finds the first bookmarks entry in the ordered set where groupId = &#63; and userId = &#63;.
1576             *
1577             * <p>
1578             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1579             * </p>
1580             *
1581             * @param groupId the group id to search with
1582             * @param userId the user id to search with
1583             * @param orderByComparator the comparator to order the set by
1584             * @return the first matching bookmarks entry
1585             * @throws com.liferay.portlet.bookmarks.NoSuchEntryException if a matching bookmarks entry could not be found
1586             * @throws SystemException if a system exception occurred
1587             */
1588            public BookmarksEntry findByG_U_First(long groupId, long userId,
1589                    OrderByComparator orderByComparator)
1590                    throws NoSuchEntryException, SystemException {
1591                    List<BookmarksEntry> list = findByG_U(groupId, userId, 0, 1,
1592                                    orderByComparator);
1593    
1594                    if (list.isEmpty()) {
1595                            StringBundler msg = new StringBundler(6);
1596    
1597                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1598    
1599                            msg.append("groupId=");
1600                            msg.append(groupId);
1601    
1602                            msg.append(", userId=");
1603                            msg.append(userId);
1604    
1605                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1606    
1607                            throw new NoSuchEntryException(msg.toString());
1608                    }
1609                    else {
1610                            return list.get(0);
1611                    }
1612            }
1613    
1614            /**
1615             * Finds the last bookmarks entry in the ordered set where groupId = &#63; and userId = &#63;.
1616             *
1617             * <p>
1618             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1619             * </p>
1620             *
1621             * @param groupId the group id to search with
1622             * @param userId the user id to search with
1623             * @param orderByComparator the comparator to order the set by
1624             * @return the last matching bookmarks entry
1625             * @throws com.liferay.portlet.bookmarks.NoSuchEntryException if a matching bookmarks entry could not be found
1626             * @throws SystemException if a system exception occurred
1627             */
1628            public BookmarksEntry findByG_U_Last(long groupId, long userId,
1629                    OrderByComparator orderByComparator)
1630                    throws NoSuchEntryException, SystemException {
1631                    int count = countByG_U(groupId, userId);
1632    
1633                    List<BookmarksEntry> list = findByG_U(groupId, userId, count - 1,
1634                                    count, orderByComparator);
1635    
1636                    if (list.isEmpty()) {
1637                            StringBundler msg = new StringBundler(6);
1638    
1639                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
1640    
1641                            msg.append("groupId=");
1642                            msg.append(groupId);
1643    
1644                            msg.append(", userId=");
1645                            msg.append(userId);
1646    
1647                            msg.append(StringPool.CLOSE_CURLY_BRACE);
1648    
1649                            throw new NoSuchEntryException(msg.toString());
1650                    }
1651                    else {
1652                            return list.get(0);
1653                    }
1654            }
1655    
1656            /**
1657             * Finds the bookmarks entries before and after the current bookmarks entry in the ordered set where groupId = &#63; and userId = &#63;.
1658             *
1659             * <p>
1660             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1661             * </p>
1662             *
1663             * @param entryId the primary key of the current bookmarks entry
1664             * @param groupId the group id to search with
1665             * @param userId the user id to search with
1666             * @param orderByComparator the comparator to order the set by
1667             * @return the previous, current, and next bookmarks entry
1668             * @throws com.liferay.portlet.bookmarks.NoSuchEntryException if a bookmarks entry with the primary key could not be found
1669             * @throws SystemException if a system exception occurred
1670             */
1671            public BookmarksEntry[] findByG_U_PrevAndNext(long entryId, long groupId,
1672                    long userId, OrderByComparator orderByComparator)
1673                    throws NoSuchEntryException, SystemException {
1674                    BookmarksEntry bookmarksEntry = findByPrimaryKey(entryId);
1675    
1676                    Session session = null;
1677    
1678                    try {
1679                            session = openSession();
1680    
1681                            BookmarksEntry[] array = new BookmarksEntryImpl[3];
1682    
1683                            array[0] = getByG_U_PrevAndNext(session, bookmarksEntry, groupId,
1684                                            userId, orderByComparator, true);
1685    
1686                            array[1] = bookmarksEntry;
1687    
1688                            array[2] = getByG_U_PrevAndNext(session, bookmarksEntry, groupId,
1689                                            userId, orderByComparator, false);
1690    
1691                            return array;
1692                    }
1693                    catch (Exception e) {
1694                            throw processException(e);
1695                    }
1696                    finally {
1697                            closeSession(session);
1698                    }
1699            }
1700    
1701            protected BookmarksEntry getByG_U_PrevAndNext(Session session,
1702                    BookmarksEntry bookmarksEntry, long groupId, long userId,
1703                    OrderByComparator orderByComparator, boolean previous) {
1704                    StringBundler query = null;
1705    
1706                    if (orderByComparator != null) {
1707                            query = new StringBundler(6 +
1708                                            (orderByComparator.getOrderByFields().length * 6));
1709                    }
1710                    else {
1711                            query = new StringBundler(3);
1712                    }
1713    
1714                    query.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE);
1715    
1716                    query.append(_FINDER_COLUMN_G_U_GROUPID_2);
1717    
1718                    query.append(_FINDER_COLUMN_G_U_USERID_2);
1719    
1720                    if (orderByComparator != null) {
1721                            String[] orderByFields = orderByComparator.getOrderByFields();
1722    
1723                            if (orderByFields.length > 0) {
1724                                    query.append(WHERE_AND);
1725                            }
1726    
1727                            for (int i = 0; i < orderByFields.length; i++) {
1728                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1729                                    query.append(orderByFields[i]);
1730    
1731                                    if ((i + 1) < orderByFields.length) {
1732                                            if (orderByComparator.isAscending() ^ previous) {
1733                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
1734                                            }
1735                                            else {
1736                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
1737                                            }
1738                                    }
1739                                    else {
1740                                            if (orderByComparator.isAscending() ^ previous) {
1741                                                    query.append(WHERE_GREATER_THAN);
1742                                            }
1743                                            else {
1744                                                    query.append(WHERE_LESSER_THAN);
1745                                            }
1746                                    }
1747                            }
1748    
1749                            query.append(ORDER_BY_CLAUSE);
1750    
1751                            for (int i = 0; i < orderByFields.length; i++) {
1752                                    query.append(_ORDER_BY_ENTITY_ALIAS);
1753                                    query.append(orderByFields[i]);
1754    
1755                                    if ((i + 1) < orderByFields.length) {
1756                                            if (orderByComparator.isAscending() ^ previous) {
1757                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
1758                                            }
1759                                            else {
1760                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
1761                                            }
1762                                    }
1763                                    else {
1764                                            if (orderByComparator.isAscending() ^ previous) {
1765                                                    query.append(ORDER_BY_ASC);
1766                                            }
1767                                            else {
1768                                                    query.append(ORDER_BY_DESC);
1769                                            }
1770                                    }
1771                            }
1772                    }
1773    
1774                    else {
1775                            query.append(BookmarksEntryModelImpl.ORDER_BY_JPQL);
1776                    }
1777    
1778                    String sql = query.toString();
1779    
1780                    Query q = session.createQuery(sql);
1781    
1782                    q.setFirstResult(0);
1783                    q.setMaxResults(2);
1784    
1785                    QueryPos qPos = QueryPos.getInstance(q);
1786    
1787                    qPos.add(groupId);
1788    
1789                    qPos.add(userId);
1790    
1791                    if (orderByComparator != null) {
1792                            Object[] values = orderByComparator.getOrderByValues(bookmarksEntry);
1793    
1794                            for (Object value : values) {
1795                                    qPos.add(value);
1796                            }
1797                    }
1798    
1799                    List<BookmarksEntry> list = q.list();
1800    
1801                    if (list.size() == 2) {
1802                            return list.get(1);
1803                    }
1804                    else {
1805                            return null;
1806                    }
1807            }
1808    
1809            /**
1810             * Filters by the user's permissions and finds all the bookmarks entries where groupId = &#63; and userId = &#63;.
1811             *
1812             * @param groupId the group id to search with
1813             * @param userId the user id to search with
1814             * @return the matching bookmarks entries that the user has permission to view
1815             * @throws SystemException if a system exception occurred
1816             */
1817            public List<BookmarksEntry> filterFindByG_U(long groupId, long userId)
1818                    throws SystemException {
1819                    return filterFindByG_U(groupId, userId, QueryUtil.ALL_POS,
1820                            QueryUtil.ALL_POS, null);
1821            }
1822    
1823            /**
1824             * Filters by the user's permissions and finds a range of all the bookmarks entries where groupId = &#63; and userId = &#63;.
1825             *
1826             * <p>
1827             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1828             * </p>
1829             *
1830             * @param groupId the group id to search with
1831             * @param userId the user id to search with
1832             * @param start the lower bound of the range of bookmarks entries to return
1833             * @param end the upper bound of the range of bookmarks entries to return (not inclusive)
1834             * @return the range of matching bookmarks entries that the user has permission to view
1835             * @throws SystemException if a system exception occurred
1836             */
1837            public List<BookmarksEntry> filterFindByG_U(long groupId, long userId,
1838                    int start, int end) throws SystemException {
1839                    return filterFindByG_U(groupId, userId, start, end, null);
1840            }
1841    
1842            /**
1843             * Filters by the user's permissions and finds an ordered range of all the bookmarks entries where groupId = &#63; and userId = &#63;.
1844             *
1845             * <p>
1846             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1847             * </p>
1848             *
1849             * @param groupId the group id to search with
1850             * @param userId the user id to search with
1851             * @param start the lower bound of the range of bookmarks entries to return
1852             * @param end the upper bound of the range of bookmarks entries to return (not inclusive)
1853             * @param orderByComparator the comparator to order the results by
1854             * @return the ordered range of matching bookmarks entries that the user has permission to view
1855             * @throws SystemException if a system exception occurred
1856             */
1857            public List<BookmarksEntry> filterFindByG_U(long groupId, long userId,
1858                    int start, int end, OrderByComparator orderByComparator)
1859                    throws SystemException {
1860                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
1861                            return findByG_U(groupId, userId, start, end, orderByComparator);
1862                    }
1863    
1864                    Session session = null;
1865    
1866                    try {
1867                            session = openSession();
1868    
1869                            StringBundler query = null;
1870    
1871                            if (orderByComparator != null) {
1872                                    query = new StringBundler(4 +
1873                                                    (orderByComparator.getOrderByFields().length * 3));
1874                            }
1875                            else {
1876                                    query = new StringBundler(4);
1877                            }
1878    
1879                            if (getDB().isSupportsInlineDistinct()) {
1880                                    query.append(_FILTER_SQL_SELECT_BOOKMARKSENTRY_WHERE);
1881                            }
1882                            else {
1883                                    query.append(_FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE);
1884                            }
1885    
1886                            query.append(_FINDER_COLUMN_G_U_GROUPID_2);
1887    
1888                            query.append(_FINDER_COLUMN_G_U_USERID_2);
1889    
1890                            if (orderByComparator != null) {
1891                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
1892                                            orderByComparator);
1893                            }
1894    
1895                            else {
1896                                    query.append(BookmarksEntryModelImpl.ORDER_BY_JPQL);
1897                            }
1898    
1899                            String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
1900                                            BookmarksEntry.class.getName(), _FILTER_COLUMN_PK,
1901                                            _FILTER_COLUMN_USERID, groupId);
1902    
1903                            SQLQuery q = session.createSQLQuery(sql);
1904    
1905                            q.addEntity(_FILTER_ENTITY_ALIAS, BookmarksEntryImpl.class);
1906    
1907                            QueryPos qPos = QueryPos.getInstance(q);
1908    
1909                            qPos.add(groupId);
1910    
1911                            qPos.add(userId);
1912    
1913                            return (List<BookmarksEntry>)QueryUtil.list(q, getDialect(), start,
1914                                    end);
1915                    }
1916                    catch (Exception e) {
1917                            throw processException(e);
1918                    }
1919                    finally {
1920                            closeSession(session);
1921                    }
1922            }
1923    
1924            /**
1925             * Finds all the bookmarks entries where groupId = &#63; and folderId = &#63;.
1926             *
1927             * @param groupId the group id to search with
1928             * @param folderId the folder id to search with
1929             * @return the matching bookmarks entries
1930             * @throws SystemException if a system exception occurred
1931             */
1932            public List<BookmarksEntry> findByG_F(long groupId, long folderId)
1933                    throws SystemException {
1934                    return findByG_F(groupId, folderId, QueryUtil.ALL_POS,
1935                            QueryUtil.ALL_POS, null);
1936            }
1937    
1938            /**
1939             * Finds a range of all the bookmarks entries where groupId = &#63; and folderId = &#63;.
1940             *
1941             * <p>
1942             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1943             * </p>
1944             *
1945             * @param groupId the group id to search with
1946             * @param folderId the folder id to search with
1947             * @param start the lower bound of the range of bookmarks entries to return
1948             * @param end the upper bound of the range of bookmarks entries to return (not inclusive)
1949             * @return the range of matching bookmarks entries
1950             * @throws SystemException if a system exception occurred
1951             */
1952            public List<BookmarksEntry> findByG_F(long groupId, long folderId,
1953                    int start, int end) throws SystemException {
1954                    return findByG_F(groupId, folderId, start, end, null);
1955            }
1956    
1957            /**
1958             * Finds an ordered range of all the bookmarks entries where groupId = &#63; and folderId = &#63;.
1959             *
1960             * <p>
1961             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
1962             * </p>
1963             *
1964             * @param groupId the group id to search with
1965             * @param folderId the folder id to search with
1966             * @param start the lower bound of the range of bookmarks entries to return
1967             * @param end the upper bound of the range of bookmarks entries to return (not inclusive)
1968             * @param orderByComparator the comparator to order the results by
1969             * @return the ordered range of matching bookmarks entries
1970             * @throws SystemException if a system exception occurred
1971             */
1972            public List<BookmarksEntry> findByG_F(long groupId, long folderId,
1973                    int start, int end, OrderByComparator orderByComparator)
1974                    throws SystemException {
1975                    Object[] finderArgs = new Object[] {
1976                                    groupId, folderId,
1977                                    
1978                                    String.valueOf(start), String.valueOf(end),
1979                                    String.valueOf(orderByComparator)
1980                            };
1981    
1982                    List<BookmarksEntry> list = (List<BookmarksEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_F,
1983                                    finderArgs, this);
1984    
1985                    if (list == null) {
1986                            Session session = null;
1987    
1988                            try {
1989                                    session = openSession();
1990    
1991                                    StringBundler query = null;
1992    
1993                                    if (orderByComparator != null) {
1994                                            query = new StringBundler(4 +
1995                                                            (orderByComparator.getOrderByFields().length * 3));
1996                                    }
1997                                    else {
1998                                            query = new StringBundler(4);
1999                                    }
2000    
2001                                    query.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE);
2002    
2003                                    query.append(_FINDER_COLUMN_G_F_GROUPID_2);
2004    
2005                                    query.append(_FINDER_COLUMN_G_F_FOLDERID_2);
2006    
2007                                    if (orderByComparator != null) {
2008                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2009                                                    orderByComparator);
2010                                    }
2011    
2012                                    else {
2013                                            query.append(BookmarksEntryModelImpl.ORDER_BY_JPQL);
2014                                    }
2015    
2016                                    String sql = query.toString();
2017    
2018                                    Query q = session.createQuery(sql);
2019    
2020                                    QueryPos qPos = QueryPos.getInstance(q);
2021    
2022                                    qPos.add(groupId);
2023    
2024                                    qPos.add(folderId);
2025    
2026                                    list = (List<BookmarksEntry>)QueryUtil.list(q, getDialect(),
2027                                                    start, end);
2028                            }
2029                            catch (Exception e) {
2030                                    throw processException(e);
2031                            }
2032                            finally {
2033                                    if (list == null) {
2034                                            list = new ArrayList<BookmarksEntry>();
2035                                    }
2036    
2037                                    cacheResult(list);
2038    
2039                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_F, finderArgs,
2040                                            list);
2041    
2042                                    closeSession(session);
2043                            }
2044                    }
2045    
2046                    return list;
2047            }
2048    
2049            /**
2050             * Finds the first bookmarks entry in the ordered set where groupId = &#63; and folderId = &#63;.
2051             *
2052             * <p>
2053             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2054             * </p>
2055             *
2056             * @param groupId the group id to search with
2057             * @param folderId the folder id to search with
2058             * @param orderByComparator the comparator to order the set by
2059             * @return the first matching bookmarks entry
2060             * @throws com.liferay.portlet.bookmarks.NoSuchEntryException if a matching bookmarks entry could not be found
2061             * @throws SystemException if a system exception occurred
2062             */
2063            public BookmarksEntry findByG_F_First(long groupId, long folderId,
2064                    OrderByComparator orderByComparator)
2065                    throws NoSuchEntryException, SystemException {
2066                    List<BookmarksEntry> list = findByG_F(groupId, folderId, 0, 1,
2067                                    orderByComparator);
2068    
2069                    if (list.isEmpty()) {
2070                            StringBundler msg = new StringBundler(6);
2071    
2072                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2073    
2074                            msg.append("groupId=");
2075                            msg.append(groupId);
2076    
2077                            msg.append(", folderId=");
2078                            msg.append(folderId);
2079    
2080                            msg.append(StringPool.CLOSE_CURLY_BRACE);
2081    
2082                            throw new NoSuchEntryException(msg.toString());
2083                    }
2084                    else {
2085                            return list.get(0);
2086                    }
2087            }
2088    
2089            /**
2090             * Finds the last bookmarks entry in the ordered set where groupId = &#63; and folderId = &#63;.
2091             *
2092             * <p>
2093             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2094             * </p>
2095             *
2096             * @param groupId the group id to search with
2097             * @param folderId the folder id to search with
2098             * @param orderByComparator the comparator to order the set by
2099             * @return the last matching bookmarks entry
2100             * @throws com.liferay.portlet.bookmarks.NoSuchEntryException if a matching bookmarks entry could not be found
2101             * @throws SystemException if a system exception occurred
2102             */
2103            public BookmarksEntry findByG_F_Last(long groupId, long folderId,
2104                    OrderByComparator orderByComparator)
2105                    throws NoSuchEntryException, SystemException {
2106                    int count = countByG_F(groupId, folderId);
2107    
2108                    List<BookmarksEntry> list = findByG_F(groupId, folderId, count - 1,
2109                                    count, orderByComparator);
2110    
2111                    if (list.isEmpty()) {
2112                            StringBundler msg = new StringBundler(6);
2113    
2114                            msg.append(_NO_SUCH_ENTITY_WITH_KEY);
2115    
2116                            msg.append("groupId=");
2117                            msg.append(groupId);
2118    
2119                            msg.append(", folderId=");
2120                            msg.append(folderId);
2121    
2122                            msg.append(StringPool.CLOSE_CURLY_BRACE);
2123    
2124                            throw new NoSuchEntryException(msg.toString());
2125                    }
2126                    else {
2127                            return list.get(0);
2128                    }
2129            }
2130    
2131            /**
2132             * Finds the bookmarks entries before and after the current bookmarks entry in the ordered set where groupId = &#63; and folderId = &#63;.
2133             *
2134             * <p>
2135             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2136             * </p>
2137             *
2138             * @param entryId the primary key of the current bookmarks entry
2139             * @param groupId the group id to search with
2140             * @param folderId the folder id to search with
2141             * @param orderByComparator the comparator to order the set by
2142             * @return the previous, current, and next bookmarks entry
2143             * @throws com.liferay.portlet.bookmarks.NoSuchEntryException if a bookmarks entry with the primary key could not be found
2144             * @throws SystemException if a system exception occurred
2145             */
2146            public BookmarksEntry[] findByG_F_PrevAndNext(long entryId, long groupId,
2147                    long folderId, OrderByComparator orderByComparator)
2148                    throws NoSuchEntryException, SystemException {
2149                    BookmarksEntry bookmarksEntry = findByPrimaryKey(entryId);
2150    
2151                    Session session = null;
2152    
2153                    try {
2154                            session = openSession();
2155    
2156                            BookmarksEntry[] array = new BookmarksEntryImpl[3];
2157    
2158                            array[0] = getByG_F_PrevAndNext(session, bookmarksEntry, groupId,
2159                                            folderId, orderByComparator, true);
2160    
2161                            array[1] = bookmarksEntry;
2162    
2163                            array[2] = getByG_F_PrevAndNext(session, bookmarksEntry, groupId,
2164                                            folderId, orderByComparator, false);
2165    
2166                            return array;
2167                    }
2168                    catch (Exception e) {
2169                            throw processException(e);
2170                    }
2171                    finally {
2172                            closeSession(session);
2173                    }
2174            }
2175    
2176            protected BookmarksEntry getByG_F_PrevAndNext(Session session,
2177                    BookmarksEntry bookmarksEntry, long groupId, long folderId,
2178                    OrderByComparator orderByComparator, boolean previous) {
2179                    StringBundler query = null;
2180    
2181                    if (orderByComparator != null) {
2182                            query = new StringBundler(6 +
2183                                            (orderByComparator.getOrderByFields().length * 6));
2184                    }
2185                    else {
2186                            query = new StringBundler(3);
2187                    }
2188    
2189                    query.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE);
2190    
2191                    query.append(_FINDER_COLUMN_G_F_GROUPID_2);
2192    
2193                    query.append(_FINDER_COLUMN_G_F_FOLDERID_2);
2194    
2195                    if (orderByComparator != null) {
2196                            String[] orderByFields = orderByComparator.getOrderByFields();
2197    
2198                            if (orderByFields.length > 0) {
2199                                    query.append(WHERE_AND);
2200                            }
2201    
2202                            for (int i = 0; i < orderByFields.length; i++) {
2203                                    query.append(_ORDER_BY_ENTITY_ALIAS);
2204                                    query.append(orderByFields[i]);
2205    
2206                                    if ((i + 1) < orderByFields.length) {
2207                                            if (orderByComparator.isAscending() ^ previous) {
2208                                                    query.append(WHERE_GREATER_THAN_HAS_NEXT);
2209                                            }
2210                                            else {
2211                                                    query.append(WHERE_LESSER_THAN_HAS_NEXT);
2212                                            }
2213                                    }
2214                                    else {
2215                                            if (orderByComparator.isAscending() ^ previous) {
2216                                                    query.append(WHERE_GREATER_THAN);
2217                                            }
2218                                            else {
2219                                                    query.append(WHERE_LESSER_THAN);
2220                                            }
2221                                    }
2222                            }
2223    
2224                            query.append(ORDER_BY_CLAUSE);
2225    
2226                            for (int i = 0; i < orderByFields.length; i++) {
2227                                    query.append(_ORDER_BY_ENTITY_ALIAS);
2228                                    query.append(orderByFields[i]);
2229    
2230                                    if ((i + 1) < orderByFields.length) {
2231                                            if (orderByComparator.isAscending() ^ previous) {
2232                                                    query.append(ORDER_BY_ASC_HAS_NEXT);
2233                                            }
2234                                            else {
2235                                                    query.append(ORDER_BY_DESC_HAS_NEXT);
2236                                            }
2237                                    }
2238                                    else {
2239                                            if (orderByComparator.isAscending() ^ previous) {
2240                                                    query.append(ORDER_BY_ASC);
2241                                            }
2242                                            else {
2243                                                    query.append(ORDER_BY_DESC);
2244                                            }
2245                                    }
2246                            }
2247                    }
2248    
2249                    else {
2250                            query.append(BookmarksEntryModelImpl.ORDER_BY_JPQL);
2251                    }
2252    
2253                    String sql = query.toString();
2254    
2255                    Query q = session.createQuery(sql);
2256    
2257                    q.setFirstResult(0);
2258                    q.setMaxResults(2);
2259    
2260                    QueryPos qPos = QueryPos.getInstance(q);
2261    
2262                    qPos.add(groupId);
2263    
2264                    qPos.add(folderId);
2265    
2266                    if (orderByComparator != null) {
2267                            Object[] values = orderByComparator.getOrderByValues(bookmarksEntry);
2268    
2269                            for (Object value : values) {
2270                                    qPos.add(value);
2271                            }
2272                    }
2273    
2274                    List<BookmarksEntry> list = q.list();
2275    
2276                    if (list.size() == 2) {
2277                            return list.get(1);
2278                    }
2279                    else {
2280                            return null;
2281                    }
2282            }
2283    
2284            /**
2285             * Finds all the bookmarks entries where groupId = &#63; and folderId = any &#63;.
2286             *
2287             * <p>
2288             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2289             * </p>
2290             *
2291             * @param groupId the group id to search with
2292             * @param folderIds the folder ids to search with
2293             * @return the matching bookmarks entries
2294             * @throws SystemException if a system exception occurred
2295             */
2296            public List<BookmarksEntry> findByG_F(long groupId, long[] folderIds)
2297                    throws SystemException {
2298                    return findByG_F(groupId, folderIds, QueryUtil.ALL_POS,
2299                            QueryUtil.ALL_POS, null);
2300            }
2301    
2302            /**
2303             * Finds a range of all the bookmarks entries where groupId = &#63; and folderId = any &#63;.
2304             *
2305             * <p>
2306             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2307             * </p>
2308             *
2309             * @param groupId the group id to search with
2310             * @param folderIds the folder ids to search with
2311             * @param start the lower bound of the range of bookmarks entries to return
2312             * @param end the upper bound of the range of bookmarks entries to return (not inclusive)
2313             * @return the range of matching bookmarks entries
2314             * @throws SystemException if a system exception occurred
2315             */
2316            public List<BookmarksEntry> findByG_F(long groupId, long[] folderIds,
2317                    int start, int end) throws SystemException {
2318                    return findByG_F(groupId, folderIds, start, end, null);
2319            }
2320    
2321            /**
2322             * Finds an ordered range of all the bookmarks entries where groupId = &#63; and folderId = any &#63;.
2323             *
2324             * <p>
2325             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2326             * </p>
2327             *
2328             * @param groupId the group id to search with
2329             * @param folderIds the folder ids to search with
2330             * @param start the lower bound of the range of bookmarks entries to return
2331             * @param end the upper bound of the range of bookmarks entries to return (not inclusive)
2332             * @param orderByComparator the comparator to order the results by
2333             * @return the ordered range of matching bookmarks entries
2334             * @throws SystemException if a system exception occurred
2335             */
2336            public List<BookmarksEntry> findByG_F(long groupId, long[] folderIds,
2337                    int start, int end, OrderByComparator orderByComparator)
2338                    throws SystemException {
2339                    Object[] finderArgs = new Object[] {
2340                                    groupId, StringUtil.merge(folderIds),
2341                                    
2342                                    String.valueOf(start), String.valueOf(end),
2343                                    String.valueOf(orderByComparator)
2344                            };
2345    
2346                    List<BookmarksEntry> list = (List<BookmarksEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_BY_G_F,
2347                                    finderArgs, this);
2348    
2349                    if (list == null) {
2350                            Session session = null;
2351    
2352                            try {
2353                                    session = openSession();
2354    
2355                                    StringBundler query = new StringBundler();
2356    
2357                                    query.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE);
2358    
2359                                    boolean conjunctionable = false;
2360    
2361                                    if (conjunctionable) {
2362                                            query.append(WHERE_AND);
2363                                    }
2364    
2365                                    query.append(_FINDER_COLUMN_G_F_GROUPID_5);
2366    
2367                                    conjunctionable = true;
2368    
2369                                    if ((folderIds == null) || (folderIds.length > 0)) {
2370                                            if (conjunctionable) {
2371                                                    query.append(WHERE_AND);
2372                                            }
2373    
2374                                            query.append(StringPool.OPEN_PARENTHESIS);
2375    
2376                                            for (int i = 0; i < folderIds.length; i++) {
2377                                                    query.append(_FINDER_COLUMN_G_F_FOLDERID_5);
2378    
2379                                                    if ((i + 1) < folderIds.length) {
2380                                                            query.append(WHERE_OR);
2381                                                    }
2382                                            }
2383    
2384                                            query.append(StringPool.CLOSE_PARENTHESIS);
2385    
2386                                            conjunctionable = true;
2387                                    }
2388    
2389                                    if (orderByComparator != null) {
2390                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2391                                                    orderByComparator);
2392                                    }
2393    
2394                                    else {
2395                                            query.append(BookmarksEntryModelImpl.ORDER_BY_JPQL);
2396                                    }
2397    
2398                                    String sql = query.toString();
2399    
2400                                    Query q = session.createQuery(sql);
2401    
2402                                    QueryPos qPos = QueryPos.getInstance(q);
2403    
2404                                    qPos.add(groupId);
2405    
2406                                    if (folderIds != null) {
2407                                            qPos.add(folderIds);
2408                                    }
2409    
2410                                    list = (List<BookmarksEntry>)QueryUtil.list(q, getDialect(),
2411                                                    start, end);
2412                            }
2413                            catch (Exception e) {
2414                                    throw processException(e);
2415                            }
2416                            finally {
2417                                    if (list == null) {
2418                                            list = new ArrayList<BookmarksEntry>();
2419                                    }
2420    
2421                                    cacheResult(list);
2422    
2423                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_BY_G_F, finderArgs,
2424                                            list);
2425    
2426                                    closeSession(session);
2427                            }
2428                    }
2429    
2430                    return list;
2431            }
2432    
2433            /**
2434             * Filters by the user's permissions and finds all the bookmarks entries where groupId = &#63; and folderId = &#63;.
2435             *
2436             * @param groupId the group id to search with
2437             * @param folderId the folder id to search with
2438             * @return the matching bookmarks entries that the user has permission to view
2439             * @throws SystemException if a system exception occurred
2440             */
2441            public List<BookmarksEntry> filterFindByG_F(long groupId, long folderId)
2442                    throws SystemException {
2443                    return filterFindByG_F(groupId, folderId, QueryUtil.ALL_POS,
2444                            QueryUtil.ALL_POS, null);
2445            }
2446    
2447            /**
2448             * Filters by the user's permissions and finds a range of all the bookmarks entries where groupId = &#63; and folderId = &#63;.
2449             *
2450             * <p>
2451             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2452             * </p>
2453             *
2454             * @param groupId the group id to search with
2455             * @param folderId the folder id to search with
2456             * @param start the lower bound of the range of bookmarks entries to return
2457             * @param end the upper bound of the range of bookmarks entries to return (not inclusive)
2458             * @return the range of matching bookmarks entries that the user has permission to view
2459             * @throws SystemException if a system exception occurred
2460             */
2461            public List<BookmarksEntry> filterFindByG_F(long groupId, long folderId,
2462                    int start, int end) throws SystemException {
2463                    return filterFindByG_F(groupId, folderId, start, end, null);
2464            }
2465    
2466            /**
2467             * Filters by the user's permissions and finds an ordered range of all the bookmarks entries where groupId = &#63; and folderId = &#63;.
2468             *
2469             * <p>
2470             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2471             * </p>
2472             *
2473             * @param groupId the group id to search with
2474             * @param folderId the folder id to search with
2475             * @param start the lower bound of the range of bookmarks entries to return
2476             * @param end the upper bound of the range of bookmarks entries to return (not inclusive)
2477             * @param orderByComparator the comparator to order the results by
2478             * @return the ordered range of matching bookmarks entries that the user has permission to view
2479             * @throws SystemException if a system exception occurred
2480             */
2481            public List<BookmarksEntry> filterFindByG_F(long groupId, long folderId,
2482                    int start, int end, OrderByComparator orderByComparator)
2483                    throws SystemException {
2484                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2485                            return findByG_F(groupId, folderId, start, end, orderByComparator);
2486                    }
2487    
2488                    Session session = null;
2489    
2490                    try {
2491                            session = openSession();
2492    
2493                            StringBundler query = null;
2494    
2495                            if (orderByComparator != null) {
2496                                    query = new StringBundler(4 +
2497                                                    (orderByComparator.getOrderByFields().length * 3));
2498                            }
2499                            else {
2500                                    query = new StringBundler(4);
2501                            }
2502    
2503                            if (getDB().isSupportsInlineDistinct()) {
2504                                    query.append(_FILTER_SQL_SELECT_BOOKMARKSENTRY_WHERE);
2505                            }
2506                            else {
2507                                    query.append(_FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE);
2508                            }
2509    
2510                            query.append(_FINDER_COLUMN_G_F_GROUPID_2);
2511    
2512                            query.append(_FINDER_COLUMN_G_F_FOLDERID_2);
2513    
2514                            if (orderByComparator != null) {
2515                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2516                                            orderByComparator);
2517                            }
2518    
2519                            else {
2520                                    query.append(BookmarksEntryModelImpl.ORDER_BY_JPQL);
2521                            }
2522    
2523                            String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2524                                            BookmarksEntry.class.getName(), _FILTER_COLUMN_PK,
2525                                            _FILTER_COLUMN_USERID, groupId);
2526    
2527                            SQLQuery q = session.createSQLQuery(sql);
2528    
2529                            q.addEntity(_FILTER_ENTITY_ALIAS, BookmarksEntryImpl.class);
2530    
2531                            QueryPos qPos = QueryPos.getInstance(q);
2532    
2533                            qPos.add(groupId);
2534    
2535                            qPos.add(folderId);
2536    
2537                            return (List<BookmarksEntry>)QueryUtil.list(q, getDialect(), start,
2538                                    end);
2539                    }
2540                    catch (Exception e) {
2541                            throw processException(e);
2542                    }
2543                    finally {
2544                            closeSession(session);
2545                    }
2546            }
2547    
2548            /**
2549             * Filters by the user's permissions and finds all the bookmarks entries where groupId = &#63; and folderId = any &#63;.
2550             *
2551             * <p>
2552             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2553             * </p>
2554             *
2555             * @param groupId the group id to search with
2556             * @param folderIds the folder ids to search with
2557             * @return the matching bookmarks entries that the user has permission to view
2558             * @throws SystemException if a system exception occurred
2559             */
2560            public List<BookmarksEntry> filterFindByG_F(long groupId, long[] folderIds)
2561                    throws SystemException {
2562                    return filterFindByG_F(groupId, folderIds, QueryUtil.ALL_POS,
2563                            QueryUtil.ALL_POS, null);
2564            }
2565    
2566            /**
2567             * Filters by the user's permissions and finds a range of all the bookmarks entries where groupId = &#63; and folderId = any &#63;.
2568             *
2569             * <p>
2570             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2571             * </p>
2572             *
2573             * @param groupId the group id to search with
2574             * @param folderIds the folder ids to search with
2575             * @param start the lower bound of the range of bookmarks entries to return
2576             * @param end the upper bound of the range of bookmarks entries to return (not inclusive)
2577             * @return the range of matching bookmarks entries that the user has permission to view
2578             * @throws SystemException if a system exception occurred
2579             */
2580            public List<BookmarksEntry> filterFindByG_F(long groupId, long[] folderIds,
2581                    int start, int end) throws SystemException {
2582                    return filterFindByG_F(groupId, folderIds, start, end, null);
2583            }
2584    
2585            /**
2586             * Filters by the user's permissions and finds an ordered range of all the bookmarks entries where groupId = &#63; and folderId = any &#63;.
2587             *
2588             * <p>
2589             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2590             * </p>
2591             *
2592             * @param groupId the group id to search with
2593             * @param folderIds the folder ids to search with
2594             * @param start the lower bound of the range of bookmarks entries to return
2595             * @param end the upper bound of the range of bookmarks entries to return (not inclusive)
2596             * @param orderByComparator the comparator to order the results by
2597             * @return the ordered range of matching bookmarks entries that the user has permission to view
2598             * @throws SystemException if a system exception occurred
2599             */
2600            public List<BookmarksEntry> filterFindByG_F(long groupId, long[] folderIds,
2601                    int start, int end, OrderByComparator orderByComparator)
2602                    throws SystemException {
2603                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
2604                            return findByG_F(groupId, folderIds, start, end, orderByComparator);
2605                    }
2606    
2607                    Session session = null;
2608    
2609                    try {
2610                            session = openSession();
2611    
2612                            StringBundler query = new StringBundler();
2613    
2614                            query.append(_FILTER_SQL_SELECT_BOOKMARKSENTRY_WHERE);
2615    
2616                            boolean conjunctionable = false;
2617    
2618                            if (conjunctionable) {
2619                                    query.append(WHERE_AND);
2620                            }
2621    
2622                            query.append(_FINDER_COLUMN_G_F_GROUPID_5);
2623    
2624                            conjunctionable = true;
2625    
2626                            if ((folderIds == null) || (folderIds.length > 0)) {
2627                                    if (conjunctionable) {
2628                                            query.append(WHERE_AND);
2629                                    }
2630    
2631                                    query.append(StringPool.OPEN_PARENTHESIS);
2632    
2633                                    for (int i = 0; i < folderIds.length; i++) {
2634                                            query.append(_FINDER_COLUMN_G_F_FOLDERID_5);
2635    
2636                                            if ((i + 1) < folderIds.length) {
2637                                                    query.append(WHERE_OR);
2638                                            }
2639                                    }
2640    
2641                                    query.append(StringPool.CLOSE_PARENTHESIS);
2642    
2643                                    conjunctionable = true;
2644                            }
2645    
2646                            if (orderByComparator != null) {
2647                                    appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2648                                            orderByComparator);
2649                            }
2650    
2651                            else {
2652                                    query.append(BookmarksEntryModelImpl.ORDER_BY_JPQL);
2653                            }
2654    
2655                            String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
2656                                            BookmarksEntry.class.getName(), _FILTER_COLUMN_PK,
2657                                            _FILTER_COLUMN_USERID, groupId);
2658    
2659                            SQLQuery q = session.createSQLQuery(sql);
2660    
2661                            q.addEntity(_FILTER_ENTITY_ALIAS, BookmarksEntryImpl.class);
2662    
2663                            QueryPos qPos = QueryPos.getInstance(q);
2664    
2665                            qPos.add(groupId);
2666    
2667                            if (folderIds != null) {
2668                                    qPos.add(folderIds);
2669                            }
2670    
2671                            return (List<BookmarksEntry>)QueryUtil.list(q, getDialect(), start,
2672                                    end);
2673                    }
2674                    catch (Exception e) {
2675                            throw processException(e);
2676                    }
2677                    finally {
2678                            closeSession(session);
2679                    }
2680            }
2681    
2682            /**
2683             * Finds all the bookmarks entries.
2684             *
2685             * @return the bookmarks entries
2686             * @throws SystemException if a system exception occurred
2687             */
2688            public List<BookmarksEntry> findAll() throws SystemException {
2689                    return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
2690            }
2691    
2692            /**
2693             * Finds a range of all the bookmarks entries.
2694             *
2695             * <p>
2696             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2697             * </p>
2698             *
2699             * @param start the lower bound of the range of bookmarks entries to return
2700             * @param end the upper bound of the range of bookmarks entries to return (not inclusive)
2701             * @return the range of bookmarks entries
2702             * @throws SystemException if a system exception occurred
2703             */
2704            public List<BookmarksEntry> findAll(int start, int end)
2705                    throws SystemException {
2706                    return findAll(start, end, null);
2707            }
2708    
2709            /**
2710             * Finds an ordered range of all the bookmarks entries.
2711             *
2712             * <p>
2713             * Useful when paginating results. Returns a maximum of <code>end - start</code> instances. <code>start</code> and <code>end</code> are not primary keys, they are indexes in the result set. Thus, <code>0</code> refers to the first result in the set. Setting both <code>start</code> and <code>end</code> to {@link com.liferay.portal.kernel.dao.orm.QueryUtil#ALL_POS} will return the full result set.
2714             * </p>
2715             *
2716             * @param start the lower bound of the range of bookmarks entries to return
2717             * @param end the upper bound of the range of bookmarks entries to return (not inclusive)
2718             * @param orderByComparator the comparator to order the results by
2719             * @return the ordered range of bookmarks entries
2720             * @throws SystemException if a system exception occurred
2721             */
2722            public List<BookmarksEntry> findAll(int start, int end,
2723                    OrderByComparator orderByComparator) throws SystemException {
2724                    Object[] finderArgs = new Object[] {
2725                                    String.valueOf(start), String.valueOf(end),
2726                                    String.valueOf(orderByComparator)
2727                            };
2728    
2729                    List<BookmarksEntry> list = (List<BookmarksEntry>)FinderCacheUtil.getResult(FINDER_PATH_FIND_ALL,
2730                                    finderArgs, this);
2731    
2732                    if (list == null) {
2733                            Session session = null;
2734    
2735                            try {
2736                                    session = openSession();
2737    
2738                                    StringBundler query = null;
2739                                    String sql = null;
2740    
2741                                    if (orderByComparator != null) {
2742                                            query = new StringBundler(2 +
2743                                                            (orderByComparator.getOrderByFields().length * 3));
2744    
2745                                            query.append(_SQL_SELECT_BOOKMARKSENTRY);
2746    
2747                                            appendOrderByComparator(query, _ORDER_BY_ENTITY_ALIAS,
2748                                                    orderByComparator);
2749    
2750                                            sql = query.toString();
2751                                    }
2752                                    else {
2753                                            sql = _SQL_SELECT_BOOKMARKSENTRY.concat(BookmarksEntryModelImpl.ORDER_BY_JPQL);
2754                                    }
2755    
2756                                    Query q = session.createQuery(sql);
2757    
2758                                    if (orderByComparator == null) {
2759                                            list = (List<BookmarksEntry>)QueryUtil.list(q,
2760                                                            getDialect(), start, end, false);
2761    
2762                                            Collections.sort(list);
2763                                    }
2764                                    else {
2765                                            list = (List<BookmarksEntry>)QueryUtil.list(q,
2766                                                            getDialect(), start, end);
2767                                    }
2768                            }
2769                            catch (Exception e) {
2770                                    throw processException(e);
2771                            }
2772                            finally {
2773                                    if (list == null) {
2774                                            list = new ArrayList<BookmarksEntry>();
2775                                    }
2776    
2777                                    cacheResult(list);
2778    
2779                                    FinderCacheUtil.putResult(FINDER_PATH_FIND_ALL, finderArgs, list);
2780    
2781                                    closeSession(session);
2782                            }
2783                    }
2784    
2785                    return list;
2786            }
2787    
2788            /**
2789             * Removes all the bookmarks entries where uuid = &#63; from the database.
2790             *
2791             * @param uuid the uuid to search with
2792             * @throws SystemException if a system exception occurred
2793             */
2794            public void removeByUuid(String uuid) throws SystemException {
2795                    for (BookmarksEntry bookmarksEntry : findByUuid(uuid)) {
2796                            remove(bookmarksEntry);
2797                    }
2798            }
2799    
2800            /**
2801             * Removes the bookmarks entry where uuid = &#63; and groupId = &#63; from the database.
2802             *
2803             * @param uuid the uuid to search with
2804             * @param groupId the group id to search with
2805             * @throws SystemException if a system exception occurred
2806             */
2807            public void removeByUUID_G(String uuid, long groupId)
2808                    throws NoSuchEntryException, SystemException {
2809                    BookmarksEntry bookmarksEntry = findByUUID_G(uuid, groupId);
2810    
2811                    remove(bookmarksEntry);
2812            }
2813    
2814            /**
2815             * Removes all the bookmarks entries where groupId = &#63; from the database.
2816             *
2817             * @param groupId the group id to search with
2818             * @throws SystemException if a system exception occurred
2819             */
2820            public void removeByGroupId(long groupId) throws SystemException {
2821                    for (BookmarksEntry bookmarksEntry : findByGroupId(groupId)) {
2822                            remove(bookmarksEntry);
2823                    }
2824            }
2825    
2826            /**
2827             * Removes all the bookmarks entries where groupId = &#63; and userId = &#63; from the database.
2828             *
2829             * @param groupId the group id to search with
2830             * @param userId the user id to search with
2831             * @throws SystemException if a system exception occurred
2832             */
2833            public void removeByG_U(long groupId, long userId)
2834                    throws SystemException {
2835                    for (BookmarksEntry bookmarksEntry : findByG_U(groupId, userId)) {
2836                            remove(bookmarksEntry);
2837                    }
2838            }
2839    
2840            /**
2841             * Removes all the bookmarks entries where groupId = &#63; and folderId = &#63; from the database.
2842             *
2843             * @param groupId the group id to search with
2844             * @param folderId the folder id to search with
2845             * @throws SystemException if a system exception occurred
2846             */
2847            public void removeByG_F(long groupId, long folderId)
2848                    throws SystemException {
2849                    for (BookmarksEntry bookmarksEntry : findByG_F(groupId, folderId)) {
2850                            remove(bookmarksEntry);
2851                    }
2852            }
2853    
2854            /**
2855             * Removes all the bookmarks entries from the database.
2856             *
2857             * @throws SystemException if a system exception occurred
2858             */
2859            public void removeAll() throws SystemException {
2860                    for (BookmarksEntry bookmarksEntry : findAll()) {
2861                            remove(bookmarksEntry);
2862                    }
2863            }
2864    
2865            /**
2866             * Counts all the bookmarks entries where uuid = &#63;.
2867             *
2868             * @param uuid the uuid to search with
2869             * @return the number of matching bookmarks entries
2870             * @throws SystemException if a system exception occurred
2871             */
2872            public int countByUuid(String uuid) throws SystemException {
2873                    Object[] finderArgs = new Object[] { uuid };
2874    
2875                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID,
2876                                    finderArgs, this);
2877    
2878                    if (count == null) {
2879                            Session session = null;
2880    
2881                            try {
2882                                    session = openSession();
2883    
2884                                    StringBundler query = new StringBundler(2);
2885    
2886                                    query.append(_SQL_COUNT_BOOKMARKSENTRY_WHERE);
2887    
2888                                    if (uuid == null) {
2889                                            query.append(_FINDER_COLUMN_UUID_UUID_1);
2890                                    }
2891                                    else {
2892                                            if (uuid.equals(StringPool.BLANK)) {
2893                                                    query.append(_FINDER_COLUMN_UUID_UUID_3);
2894                                            }
2895                                            else {
2896                                                    query.append(_FINDER_COLUMN_UUID_UUID_2);
2897                                            }
2898                                    }
2899    
2900                                    String sql = query.toString();
2901    
2902                                    Query q = session.createQuery(sql);
2903    
2904                                    QueryPos qPos = QueryPos.getInstance(q);
2905    
2906                                    if (uuid != null) {
2907                                            qPos.add(uuid);
2908                                    }
2909    
2910                                    count = (Long)q.uniqueResult();
2911                            }
2912                            catch (Exception e) {
2913                                    throw processException(e);
2914                            }
2915                            finally {
2916                                    if (count == null) {
2917                                            count = Long.valueOf(0);
2918                                    }
2919    
2920                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID,
2921                                            finderArgs, count);
2922    
2923                                    closeSession(session);
2924                            }
2925                    }
2926    
2927                    return count.intValue();
2928            }
2929    
2930            /**
2931             * Counts all the bookmarks entries where uuid = &#63; and groupId = &#63;.
2932             *
2933             * @param uuid the uuid to search with
2934             * @param groupId the group id to search with
2935             * @return the number of matching bookmarks entries
2936             * @throws SystemException if a system exception occurred
2937             */
2938            public int countByUUID_G(String uuid, long groupId)
2939                    throws SystemException {
2940                    Object[] finderArgs = new Object[] { uuid, groupId };
2941    
2942                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_UUID_G,
2943                                    finderArgs, this);
2944    
2945                    if (count == null) {
2946                            Session session = null;
2947    
2948                            try {
2949                                    session = openSession();
2950    
2951                                    StringBundler query = new StringBundler(3);
2952    
2953                                    query.append(_SQL_COUNT_BOOKMARKSENTRY_WHERE);
2954    
2955                                    if (uuid == null) {
2956                                            query.append(_FINDER_COLUMN_UUID_G_UUID_1);
2957                                    }
2958                                    else {
2959                                            if (uuid.equals(StringPool.BLANK)) {
2960                                                    query.append(_FINDER_COLUMN_UUID_G_UUID_3);
2961                                            }
2962                                            else {
2963                                                    query.append(_FINDER_COLUMN_UUID_G_UUID_2);
2964                                            }
2965                                    }
2966    
2967                                    query.append(_FINDER_COLUMN_UUID_G_GROUPID_2);
2968    
2969                                    String sql = query.toString();
2970    
2971                                    Query q = session.createQuery(sql);
2972    
2973                                    QueryPos qPos = QueryPos.getInstance(q);
2974    
2975                                    if (uuid != null) {
2976                                            qPos.add(uuid);
2977                                    }
2978    
2979                                    qPos.add(groupId);
2980    
2981                                    count = (Long)q.uniqueResult();
2982                            }
2983                            catch (Exception e) {
2984                                    throw processException(e);
2985                            }
2986                            finally {
2987                                    if (count == null) {
2988                                            count = Long.valueOf(0);
2989                                    }
2990    
2991                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_UUID_G,
2992                                            finderArgs, count);
2993    
2994                                    closeSession(session);
2995                            }
2996                    }
2997    
2998                    return count.intValue();
2999            }
3000    
3001            /**
3002             * Counts all the bookmarks entries where groupId = &#63;.
3003             *
3004             * @param groupId the group id to search with
3005             * @return the number of matching bookmarks entries
3006             * @throws SystemException if a system exception occurred
3007             */
3008            public int countByGroupId(long groupId) throws SystemException {
3009                    Object[] finderArgs = new Object[] { groupId };
3010    
3011                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_GROUPID,
3012                                    finderArgs, this);
3013    
3014                    if (count == null) {
3015                            Session session = null;
3016    
3017                            try {
3018                                    session = openSession();
3019    
3020                                    StringBundler query = new StringBundler(2);
3021    
3022                                    query.append(_SQL_COUNT_BOOKMARKSENTRY_WHERE);
3023    
3024                                    query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
3025    
3026                                    String sql = query.toString();
3027    
3028                                    Query q = session.createQuery(sql);
3029    
3030                                    QueryPos qPos = QueryPos.getInstance(q);
3031    
3032                                    qPos.add(groupId);
3033    
3034                                    count = (Long)q.uniqueResult();
3035                            }
3036                            catch (Exception e) {
3037                                    throw processException(e);
3038                            }
3039                            finally {
3040                                    if (count == null) {
3041                                            count = Long.valueOf(0);
3042                                    }
3043    
3044                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_GROUPID,
3045                                            finderArgs, count);
3046    
3047                                    closeSession(session);
3048                            }
3049                    }
3050    
3051                    return count.intValue();
3052            }
3053    
3054            /**
3055             * Filters by the user's permissions and counts all the bookmarks entries where groupId = &#63;.
3056             *
3057             * @param groupId the group id to search with
3058             * @return the number of matching bookmarks entries that the user has permission to view
3059             * @throws SystemException if a system exception occurred
3060             */
3061            public int filterCountByGroupId(long groupId) throws SystemException {
3062                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
3063                            return countByGroupId(groupId);
3064                    }
3065    
3066                    Session session = null;
3067    
3068                    try {
3069                            session = openSession();
3070    
3071                            StringBundler query = new StringBundler(2);
3072    
3073                            query.append(_FILTER_SQL_COUNT_BOOKMARKSENTRY_WHERE);
3074    
3075                            query.append(_FINDER_COLUMN_GROUPID_GROUPID_2);
3076    
3077                            String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3078                                            BookmarksEntry.class.getName(), _FILTER_COLUMN_PK,
3079                                            _FILTER_COLUMN_USERID, groupId);
3080    
3081                            SQLQuery q = session.createSQLQuery(sql);
3082    
3083                            q.addScalar(COUNT_COLUMN_NAME,
3084                                    com.liferay.portal.kernel.dao.orm.Type.LONG);
3085    
3086                            QueryPos qPos = QueryPos.getInstance(q);
3087    
3088                            qPos.add(groupId);
3089    
3090                            Long count = (Long)q.uniqueResult();
3091    
3092                            return count.intValue();
3093                    }
3094                    catch (Exception e) {
3095                            throw processException(e);
3096                    }
3097                    finally {
3098                            closeSession(session);
3099                    }
3100            }
3101    
3102            /**
3103             * Counts all the bookmarks entries where groupId = &#63; and userId = &#63;.
3104             *
3105             * @param groupId the group id to search with
3106             * @param userId the user id to search with
3107             * @return the number of matching bookmarks entries
3108             * @throws SystemException if a system exception occurred
3109             */
3110            public int countByG_U(long groupId, long userId) throws SystemException {
3111                    Object[] finderArgs = new Object[] { groupId, userId };
3112    
3113                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_U,
3114                                    finderArgs, this);
3115    
3116                    if (count == null) {
3117                            Session session = null;
3118    
3119                            try {
3120                                    session = openSession();
3121    
3122                                    StringBundler query = new StringBundler(3);
3123    
3124                                    query.append(_SQL_COUNT_BOOKMARKSENTRY_WHERE);
3125    
3126                                    query.append(_FINDER_COLUMN_G_U_GROUPID_2);
3127    
3128                                    query.append(_FINDER_COLUMN_G_U_USERID_2);
3129    
3130                                    String sql = query.toString();
3131    
3132                                    Query q = session.createQuery(sql);
3133    
3134                                    QueryPos qPos = QueryPos.getInstance(q);
3135    
3136                                    qPos.add(groupId);
3137    
3138                                    qPos.add(userId);
3139    
3140                                    count = (Long)q.uniqueResult();
3141                            }
3142                            catch (Exception e) {
3143                                    throw processException(e);
3144                            }
3145                            finally {
3146                                    if (count == null) {
3147                                            count = Long.valueOf(0);
3148                                    }
3149    
3150                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_U, finderArgs,
3151                                            count);
3152    
3153                                    closeSession(session);
3154                            }
3155                    }
3156    
3157                    return count.intValue();
3158            }
3159    
3160            /**
3161             * Filters by the user's permissions and counts all the bookmarks entries where groupId = &#63; and userId = &#63;.
3162             *
3163             * @param groupId the group id to search with
3164             * @param userId the user id to search with
3165             * @return the number of matching bookmarks entries that the user has permission to view
3166             * @throws SystemException if a system exception occurred
3167             */
3168            public int filterCountByG_U(long groupId, long userId)
3169                    throws SystemException {
3170                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
3171                            return countByG_U(groupId, userId);
3172                    }
3173    
3174                    Session session = null;
3175    
3176                    try {
3177                            session = openSession();
3178    
3179                            StringBundler query = new StringBundler(3);
3180    
3181                            query.append(_FILTER_SQL_COUNT_BOOKMARKSENTRY_WHERE);
3182    
3183                            query.append(_FINDER_COLUMN_G_U_GROUPID_2);
3184    
3185                            query.append(_FINDER_COLUMN_G_U_USERID_2);
3186    
3187                            String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3188                                            BookmarksEntry.class.getName(), _FILTER_COLUMN_PK,
3189                                            _FILTER_COLUMN_USERID, groupId);
3190    
3191                            SQLQuery q = session.createSQLQuery(sql);
3192    
3193                            q.addScalar(COUNT_COLUMN_NAME,
3194                                    com.liferay.portal.kernel.dao.orm.Type.LONG);
3195    
3196                            QueryPos qPos = QueryPos.getInstance(q);
3197    
3198                            qPos.add(groupId);
3199    
3200                            qPos.add(userId);
3201    
3202                            Long count = (Long)q.uniqueResult();
3203    
3204                            return count.intValue();
3205                    }
3206                    catch (Exception e) {
3207                            throw processException(e);
3208                    }
3209                    finally {
3210                            closeSession(session);
3211                    }
3212            }
3213    
3214            /**
3215             * Counts all the bookmarks entries where groupId = &#63; and folderId = &#63;.
3216             *
3217             * @param groupId the group id to search with
3218             * @param folderId the folder id to search with
3219             * @return the number of matching bookmarks entries
3220             * @throws SystemException if a system exception occurred
3221             */
3222            public int countByG_F(long groupId, long folderId)
3223                    throws SystemException {
3224                    Object[] finderArgs = new Object[] { groupId, folderId };
3225    
3226                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_F,
3227                                    finderArgs, this);
3228    
3229                    if (count == null) {
3230                            Session session = null;
3231    
3232                            try {
3233                                    session = openSession();
3234    
3235                                    StringBundler query = new StringBundler(3);
3236    
3237                                    query.append(_SQL_COUNT_BOOKMARKSENTRY_WHERE);
3238    
3239                                    query.append(_FINDER_COLUMN_G_F_GROUPID_2);
3240    
3241                                    query.append(_FINDER_COLUMN_G_F_FOLDERID_2);
3242    
3243                                    String sql = query.toString();
3244    
3245                                    Query q = session.createQuery(sql);
3246    
3247                                    QueryPos qPos = QueryPos.getInstance(q);
3248    
3249                                    qPos.add(groupId);
3250    
3251                                    qPos.add(folderId);
3252    
3253                                    count = (Long)q.uniqueResult();
3254                            }
3255                            catch (Exception e) {
3256                                    throw processException(e);
3257                            }
3258                            finally {
3259                                    if (count == null) {
3260                                            count = Long.valueOf(0);
3261                                    }
3262    
3263                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_F, finderArgs,
3264                                            count);
3265    
3266                                    closeSession(session);
3267                            }
3268                    }
3269    
3270                    return count.intValue();
3271            }
3272    
3273            /**
3274             * Counts all the bookmarks entries where groupId = &#63; and folderId = any &#63;.
3275             *
3276             * @param groupId the group id to search with
3277             * @param folderIds the folder ids to search with
3278             * @return the number of matching bookmarks entries
3279             * @throws SystemException if a system exception occurred
3280             */
3281            public int countByG_F(long groupId, long[] folderIds)
3282                    throws SystemException {
3283                    Object[] finderArgs = new Object[] { groupId, StringUtil.merge(folderIds) };
3284    
3285                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_BY_G_F,
3286                                    finderArgs, this);
3287    
3288                    if (count == null) {
3289                            Session session = null;
3290    
3291                            try {
3292                                    session = openSession();
3293    
3294                                    StringBundler query = new StringBundler();
3295    
3296                                    query.append(_SQL_COUNT_BOOKMARKSENTRY_WHERE);
3297    
3298                                    boolean conjunctionable = false;
3299    
3300                                    if (conjunctionable) {
3301                                            query.append(WHERE_AND);
3302                                    }
3303    
3304                                    query.append(_FINDER_COLUMN_G_F_GROUPID_5);
3305    
3306                                    conjunctionable = true;
3307    
3308                                    if ((folderIds == null) || (folderIds.length > 0)) {
3309                                            if (conjunctionable) {
3310                                                    query.append(WHERE_AND);
3311                                            }
3312    
3313                                            query.append(StringPool.OPEN_PARENTHESIS);
3314    
3315                                            for (int i = 0; i < folderIds.length; i++) {
3316                                                    query.append(_FINDER_COLUMN_G_F_FOLDERID_5);
3317    
3318                                                    if ((i + 1) < folderIds.length) {
3319                                                            query.append(WHERE_OR);
3320                                                    }
3321                                            }
3322    
3323                                            query.append(StringPool.CLOSE_PARENTHESIS);
3324    
3325                                            conjunctionable = true;
3326                                    }
3327    
3328                                    String sql = query.toString();
3329    
3330                                    Query q = session.createQuery(sql);
3331    
3332                                    QueryPos qPos = QueryPos.getInstance(q);
3333    
3334                                    qPos.add(groupId);
3335    
3336                                    if (folderIds != null) {
3337                                            qPos.add(folderIds);
3338                                    }
3339    
3340                                    count = (Long)q.uniqueResult();
3341                            }
3342                            catch (Exception e) {
3343                                    throw processException(e);
3344                            }
3345                            finally {
3346                                    if (count == null) {
3347                                            count = Long.valueOf(0);
3348                                    }
3349    
3350                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_BY_G_F, finderArgs,
3351                                            count);
3352    
3353                                    closeSession(session);
3354                            }
3355                    }
3356    
3357                    return count.intValue();
3358            }
3359    
3360            /**
3361             * Filters by the user's permissions and counts all the bookmarks entries where groupId = &#63; and folderId = &#63;.
3362             *
3363             * @param groupId the group id to search with
3364             * @param folderId the folder id to search with
3365             * @return the number of matching bookmarks entries that the user has permission to view
3366             * @throws SystemException if a system exception occurred
3367             */
3368            public int filterCountByG_F(long groupId, long folderId)
3369                    throws SystemException {
3370                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
3371                            return countByG_F(groupId, folderId);
3372                    }
3373    
3374                    Session session = null;
3375    
3376                    try {
3377                            session = openSession();
3378    
3379                            StringBundler query = new StringBundler(3);
3380    
3381                            query.append(_FILTER_SQL_COUNT_BOOKMARKSENTRY_WHERE);
3382    
3383                            query.append(_FINDER_COLUMN_G_F_GROUPID_2);
3384    
3385                            query.append(_FINDER_COLUMN_G_F_FOLDERID_2);
3386    
3387                            String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3388                                            BookmarksEntry.class.getName(), _FILTER_COLUMN_PK,
3389                                            _FILTER_COLUMN_USERID, groupId);
3390    
3391                            SQLQuery q = session.createSQLQuery(sql);
3392    
3393                            q.addScalar(COUNT_COLUMN_NAME,
3394                                    com.liferay.portal.kernel.dao.orm.Type.LONG);
3395    
3396                            QueryPos qPos = QueryPos.getInstance(q);
3397    
3398                            qPos.add(groupId);
3399    
3400                            qPos.add(folderId);
3401    
3402                            Long count = (Long)q.uniqueResult();
3403    
3404                            return count.intValue();
3405                    }
3406                    catch (Exception e) {
3407                            throw processException(e);
3408                    }
3409                    finally {
3410                            closeSession(session);
3411                    }
3412            }
3413    
3414            /**
3415             * Filters by the user's permissions and counts all the bookmarks entries where groupId = &#63; and folderId = any &#63;.
3416             *
3417             * @param groupId the group id to search with
3418             * @param folderIds the folder ids to search with
3419             * @return the number of matching bookmarks entries that the user has permission to view
3420             * @throws SystemException if a system exception occurred
3421             */
3422            public int filterCountByG_F(long groupId, long[] folderIds)
3423                    throws SystemException {
3424                    if (!InlineSQLHelperUtil.isEnabled(groupId)) {
3425                            return countByG_F(groupId, folderIds);
3426                    }
3427    
3428                    Session session = null;
3429    
3430                    try {
3431                            session = openSession();
3432    
3433                            StringBundler query = new StringBundler();
3434    
3435                            query.append(_FILTER_SQL_COUNT_BOOKMARKSENTRY_WHERE);
3436    
3437                            boolean conjunctionable = false;
3438    
3439                            if (conjunctionable) {
3440                                    query.append(WHERE_AND);
3441                            }
3442    
3443                            query.append(_FINDER_COLUMN_G_F_GROUPID_5);
3444    
3445                            conjunctionable = true;
3446    
3447                            if ((folderIds == null) || (folderIds.length > 0)) {
3448                                    if (conjunctionable) {
3449                                            query.append(WHERE_AND);
3450                                    }
3451    
3452                                    query.append(StringPool.OPEN_PARENTHESIS);
3453    
3454                                    for (int i = 0; i < folderIds.length; i++) {
3455                                            query.append(_FINDER_COLUMN_G_F_FOLDERID_5);
3456    
3457                                            if ((i + 1) < folderIds.length) {
3458                                                    query.append(WHERE_OR);
3459                                            }
3460                                    }
3461    
3462                                    query.append(StringPool.CLOSE_PARENTHESIS);
3463    
3464                                    conjunctionable = true;
3465                            }
3466    
3467                            String sql = InlineSQLHelperUtil.replacePermissionCheck(query.toString(),
3468                                            BookmarksEntry.class.getName(), _FILTER_COLUMN_PK,
3469                                            _FILTER_COLUMN_USERID, groupId);
3470    
3471                            SQLQuery q = session.createSQLQuery(sql);
3472    
3473                            q.addScalar(COUNT_COLUMN_NAME,
3474                                    com.liferay.portal.kernel.dao.orm.Type.LONG);
3475    
3476                            QueryPos qPos = QueryPos.getInstance(q);
3477    
3478                            qPos.add(groupId);
3479    
3480                            if (folderIds != null) {
3481                                    qPos.add(folderIds);
3482                            }
3483    
3484                            Long count = (Long)q.uniqueResult();
3485    
3486                            return count.intValue();
3487                    }
3488                    catch (Exception e) {
3489                            throw processException(e);
3490                    }
3491                    finally {
3492                            closeSession(session);
3493                    }
3494            }
3495    
3496            /**
3497             * Counts all the bookmarks entries.
3498             *
3499             * @return the number of bookmarks entries
3500             * @throws SystemException if a system exception occurred
3501             */
3502            public int countAll() throws SystemException {
3503                    Object[] finderArgs = new Object[0];
3504    
3505                    Long count = (Long)FinderCacheUtil.getResult(FINDER_PATH_COUNT_ALL,
3506                                    finderArgs, this);
3507    
3508                    if (count == null) {
3509                            Session session = null;
3510    
3511                            try {
3512                                    session = openSession();
3513    
3514                                    Query q = session.createQuery(_SQL_COUNT_BOOKMARKSENTRY);
3515    
3516                                    count = (Long)q.uniqueResult();
3517                            }
3518                            catch (Exception e) {
3519                                    throw processException(e);
3520                            }
3521                            finally {
3522                                    if (count == null) {
3523                                            count = Long.valueOf(0);
3524                                    }
3525    
3526                                    FinderCacheUtil.putResult(FINDER_PATH_COUNT_ALL, finderArgs,
3527                                            count);
3528    
3529                                    closeSession(session);
3530                            }
3531                    }
3532    
3533                    return count.intValue();
3534            }
3535    
3536            /**
3537             * Initializes the bookmarks entry persistence.
3538             */
3539            public void afterPropertiesSet() {
3540                    String[] listenerClassNames = StringUtil.split(GetterUtil.getString(
3541                                            com.liferay.portal.util.PropsUtil.get(
3542                                                    "value.object.listener.com.liferay.portlet.bookmarks.model.BookmarksEntry")));
3543    
3544                    if (listenerClassNames.length > 0) {
3545                            try {
3546                                    List<ModelListener<BookmarksEntry>> listenersList = new ArrayList<ModelListener<BookmarksEntry>>();
3547    
3548                                    for (String listenerClassName : listenerClassNames) {
3549                                            listenersList.add((ModelListener<BookmarksEntry>)InstanceFactory.newInstance(
3550                                                            listenerClassName));
3551                                    }
3552    
3553                                    listeners = listenersList.toArray(new ModelListener[listenersList.size()]);
3554                            }
3555                            catch (Exception e) {
3556                                    _log.error(e);
3557                            }
3558                    }
3559            }
3560    
3561            public void destroy() {
3562                    EntityCacheUtil.removeCache(BookmarksEntryImpl.class.getName());
3563                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_ENTITY);
3564                    FinderCacheUtil.removeCache(FINDER_CLASS_NAME_LIST);
3565            }
3566    
3567            @BeanReference(type = BookmarksEntryPersistence.class)
3568            protected BookmarksEntryPersistence bookmarksEntryPersistence;
3569            @BeanReference(type = BookmarksFolderPersistence.class)
3570            protected BookmarksFolderPersistence bookmarksFolderPersistence;
3571            @BeanReference(type = ResourcePersistence.class)
3572            protected ResourcePersistence resourcePersistence;
3573            @BeanReference(type = UserPersistence.class)
3574            protected UserPersistence userPersistence;
3575            @BeanReference(type = AssetEntryPersistence.class)
3576            protected AssetEntryPersistence assetEntryPersistence;
3577            @BeanReference(type = AssetTagPersistence.class)
3578            protected AssetTagPersistence assetTagPersistence;
3579            @BeanReference(type = ExpandoValuePersistence.class)
3580            protected ExpandoValuePersistence expandoValuePersistence;
3581            private static final String _SQL_SELECT_BOOKMARKSENTRY = "SELECT bookmarksEntry FROM BookmarksEntry bookmarksEntry";
3582            private static final String _SQL_SELECT_BOOKMARKSENTRY_WHERE = "SELECT bookmarksEntry FROM BookmarksEntry bookmarksEntry WHERE ";
3583            private static final String _SQL_COUNT_BOOKMARKSENTRY = "SELECT COUNT(bookmarksEntry) FROM BookmarksEntry bookmarksEntry";
3584            private static final String _SQL_COUNT_BOOKMARKSENTRY_WHERE = "SELECT COUNT(bookmarksEntry) FROM BookmarksEntry bookmarksEntry WHERE ";
3585            private static final String _FINDER_COLUMN_UUID_UUID_1 = "bookmarksEntry.uuid IS NULL";
3586            private static final String _FINDER_COLUMN_UUID_UUID_2 = "bookmarksEntry.uuid = ?";
3587            private static final String _FINDER_COLUMN_UUID_UUID_3 = "(bookmarksEntry.uuid IS NULL OR bookmarksEntry.uuid = ?)";
3588            private static final String _FINDER_COLUMN_UUID_G_UUID_1 = "bookmarksEntry.uuid IS NULL AND ";
3589            private static final String _FINDER_COLUMN_UUID_G_UUID_2 = "bookmarksEntry.uuid = ? AND ";
3590            private static final String _FINDER_COLUMN_UUID_G_UUID_3 = "(bookmarksEntry.uuid IS NULL OR bookmarksEntry.uuid = ?) AND ";
3591            private static final String _FINDER_COLUMN_UUID_G_GROUPID_2 = "bookmarksEntry.groupId = ?";
3592            private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "bookmarksEntry.groupId = ?";
3593            private static final String _FINDER_COLUMN_G_U_GROUPID_2 = "bookmarksEntry.groupId = ? AND ";
3594            private static final String _FINDER_COLUMN_G_U_USERID_2 = "bookmarksEntry.userId = ?";
3595            private static final String _FINDER_COLUMN_G_F_GROUPID_2 = "bookmarksEntry.groupId = ? AND ";
3596            private static final String _FINDER_COLUMN_G_F_GROUPID_5 = "(" +
3597                    _removeConjunction(_FINDER_COLUMN_G_F_GROUPID_2) + ")";
3598            private static final String _FINDER_COLUMN_G_F_FOLDERID_2 = "bookmarksEntry.folderId = ?";
3599            private static final String _FINDER_COLUMN_G_F_FOLDERID_5 = "(" +
3600                    _removeConjunction(_FINDER_COLUMN_G_F_FOLDERID_2) + ")";
3601    
3602            private static String _removeConjunction(String sql) {
3603                    int pos = sql.indexOf(" AND ");
3604    
3605                    if (pos != -1) {
3606                            sql = sql.substring(0, pos);
3607                    }
3608    
3609                    return sql;
3610            }
3611    
3612            private static final String _FILTER_SQL_SELECT_BOOKMARKSENTRY_WHERE = "SELECT DISTINCT {bookmarksEntry.*} FROM BookmarksEntry bookmarksEntry WHERE ";
3613            private static final String _FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE =
3614                    "SELECT {bookmarksEntry.*} FROM (SELECT DISTINCT entryId FROM BookmarksEntry) bookmarksEntry2 INNER JOIN BookmarksEntry bookmarksEntry ON (bookmarksEntry2.entryId = bookmarksEntry.entryId) WHERE ";
3615            private static final String _FILTER_SQL_COUNT_BOOKMARKSENTRY_WHERE = "SELECT COUNT(DISTINCT bookmarksEntry.entryId) AS COUNT_VALUE FROM BookmarksEntry bookmarksEntry WHERE ";
3616            private static final String _FILTER_COLUMN_PK = "bookmarksEntry.entryId";
3617            private static final String _FILTER_COLUMN_USERID = "bookmarksEntry.userId";
3618            private static final String _FILTER_ENTITY_ALIAS = "bookmarksEntry";
3619            private static final String _ORDER_BY_ENTITY_ALIAS = "bookmarksEntry.";
3620            private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No BookmarksEntry exists with the primary key ";
3621            private static final String _NO_SUCH_ENTITY_WITH_KEY = "No BookmarksEntry exists with the key {";
3622            private static Log _log = LogFactoryUtil.getLog(BookmarksEntryPersistenceImpl.class);
3623    }