All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.liferay.bookmarks.service.persistence.impl.BookmarksEntryPersistenceImpl Maven / Gradle / Ivy

There is a newer version: 5.0.60
Show newest version
/**
 * SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
 * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
 */

package com.liferay.bookmarks.service.persistence.impl;

import com.liferay.bookmarks.exception.NoSuchEntryException;
import com.liferay.bookmarks.model.BookmarksEntry;
import com.liferay.bookmarks.model.BookmarksEntryTable;
import com.liferay.bookmarks.model.impl.BookmarksEntryImpl;
import com.liferay.bookmarks.model.impl.BookmarksEntryModelImpl;
import com.liferay.bookmarks.service.persistence.BookmarksEntryPersistence;
import com.liferay.bookmarks.service.persistence.BookmarksEntryUtil;
import com.liferay.bookmarks.service.persistence.impl.constants.BookmarksPersistenceConstants;
import com.liferay.petra.lang.SafeCloseable;
import com.liferay.petra.string.StringBundler;
import com.liferay.portal.kernel.change.tracking.CTCollectionThreadLocal;
import com.liferay.portal.kernel.change.tracking.CTColumnResolutionType;
import com.liferay.portal.kernel.configuration.Configuration;
import com.liferay.portal.kernel.dao.orm.EntityCache;
import com.liferay.portal.kernel.dao.orm.FinderCache;
import com.liferay.portal.kernel.dao.orm.FinderPath;
import com.liferay.portal.kernel.dao.orm.Query;
import com.liferay.portal.kernel.dao.orm.QueryPos;
import com.liferay.portal.kernel.dao.orm.QueryUtil;
import com.liferay.portal.kernel.dao.orm.SQLQuery;
import com.liferay.portal.kernel.dao.orm.Session;
import com.liferay.portal.kernel.dao.orm.SessionFactory;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.security.auth.CompanyThreadLocal;
import com.liferay.portal.kernel.security.permission.InlineSQLHelperUtil;
import com.liferay.portal.kernel.service.ServiceContext;
import com.liferay.portal.kernel.service.ServiceContextThreadLocal;
import com.liferay.portal.kernel.service.persistence.change.tracking.helper.CTPersistenceHelper;
import com.liferay.portal.kernel.service.persistence.impl.BasePersistenceImpl;
import com.liferay.portal.kernel.util.ArrayUtil;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.OrderByComparator;
import com.liferay.portal.kernel.util.PropsKeys;
import com.liferay.portal.kernel.util.PropsUtil;
import com.liferay.portal.kernel.util.ProxyUtil;
import com.liferay.portal.kernel.util.SetUtil;
import com.liferay.portal.kernel.util.StringUtil;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.kernel.uuid.PortalUUIDUtil;

import java.io.Serializable;

import java.lang.reflect.InvocationHandler;

import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;

import javax.sql.DataSource;

import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Deactivate;
import org.osgi.service.component.annotations.Reference;

/**
 * The persistence implementation for the bookmarks entry service.
 *
 * 

* Caching information and settings can be found in portal.properties *

* * @author Brian Wing Shun Chan * @generated */ @Component(service = BookmarksEntryPersistence.class) public class BookmarksEntryPersistenceImpl extends BasePersistenceImpl implements BookmarksEntryPersistence { /* * NOTE FOR DEVELOPERS: * * Never modify or reference this class directly. Always use BookmarksEntryUtil to access the bookmarks entry persistence. Modify service.xml and rerun ServiceBuilder to regenerate this class. */ public static final String FINDER_CLASS_NAME_ENTITY = BookmarksEntryImpl.class.getName(); public static final String FINDER_CLASS_NAME_LIST_WITH_PAGINATION = FINDER_CLASS_NAME_ENTITY + ".List1"; public static final String FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION = FINDER_CLASS_NAME_ENTITY + ".List2"; private FinderPath _finderPathWithPaginationFindAll; private FinderPath _finderPathWithoutPaginationFindAll; private FinderPath _finderPathCountAll; private FinderPath _finderPathWithPaginationFindByUuid; private FinderPath _finderPathWithoutPaginationFindByUuid; private FinderPath _finderPathCountByUuid; /** * Returns all the bookmarks entries where uuid = ?. * * @param uuid the uuid * @return the matching bookmarks entries */ @Override public List findByUuid(String uuid) { return findByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the bookmarks entries where uuid = ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param uuid the uuid * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @return the range of matching bookmarks entries */ @Override public List findByUuid(String uuid, int start, int end) { return findByUuid(uuid, start, end, null); } /** * Returns an ordered range of all the bookmarks entries where uuid = ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param uuid the uuid * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching bookmarks entries */ @Override public List findByUuid( String uuid, int start, int end, OrderByComparator orderByComparator) { return findByUuid(uuid, start, end, orderByComparator, true); } /** * Returns an ordered range of all the bookmarks entries where uuid = ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param uuid the uuid * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @param useFinderCache whether to use the finder cache * @return the ordered range of matching bookmarks entries */ @Override public List findByUuid( String uuid, int start, int end, OrderByComparator orderByComparator, boolean useFinderCache) { try (SafeCloseable safeCloseable = ctPersistenceHelper.setCTCollectionIdWithSafeCloseable( BookmarksEntry.class)) { uuid = Objects.toString(uuid, ""); FinderPath finderPath = null; Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { if (useFinderCache) { finderPath = _finderPathWithoutPaginationFindByUuid; finderArgs = new Object[] {uuid}; } } else if (useFinderCache) { finderPath = _finderPathWithPaginationFindByUuid; finderArgs = new Object[] {uuid, start, end, orderByComparator}; } List list = null; if (useFinderCache) { list = (List)finderCache.getResult( finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (BookmarksEntry bookmarksEntry : list) { if (!uuid.equals(bookmarksEntry.getUuid())) { list = null; break; } } } } if (list == null) { StringBundler sb = null; if (orderByComparator != null) { sb = new StringBundler( 3 + (orderByComparator.getOrderByFields().length * 2)); } else { sb = new StringBundler(3); } sb.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE); boolean bindUuid = false; if (uuid.isEmpty()) { sb.append(_FINDER_COLUMN_UUID_UUID_3); } else { bindUuid = true; sb.append(_FINDER_COLUMN_UUID_UUID_2); } if (orderByComparator != null) { appendOrderByComparator( sb, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_JPQL); } String sql = sb.toString(); Session session = null; try { session = openSession(); Query query = session.createQuery(sql); QueryPos queryPos = QueryPos.getInstance(query); if (bindUuid) { queryPos.add(uuid); } list = (List)QueryUtil.list( query, getDialect(), start, end); cacheResult(list); if (useFinderCache) { finderCache.putResult(finderPath, finderArgs, list); } } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } return list; } } /** * Returns the first bookmarks entry in the ordered set where uuid = ?. * * @param uuid the uuid * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching bookmarks entry * @throws NoSuchEntryException if a matching bookmarks entry could not be found */ @Override public BookmarksEntry findByUuid_First( String uuid, OrderByComparator orderByComparator) throws NoSuchEntryException { BookmarksEntry bookmarksEntry = fetchByUuid_First( uuid, orderByComparator); if (bookmarksEntry != null) { return bookmarksEntry; } StringBundler sb = new StringBundler(4); sb.append(_NO_SUCH_ENTITY_WITH_KEY); sb.append("uuid="); sb.append(uuid); sb.append("}"); throw new NoSuchEntryException(sb.toString()); } /** * Returns the first bookmarks entry in the ordered set where uuid = ?. * * @param uuid the uuid * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching bookmarks entry, or null if a matching bookmarks entry could not be found */ @Override public BookmarksEntry fetchByUuid_First( String uuid, OrderByComparator orderByComparator) { List list = findByUuid(uuid, 0, 1, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the last bookmarks entry in the ordered set where uuid = ?. * * @param uuid the uuid * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching bookmarks entry * @throws NoSuchEntryException if a matching bookmarks entry could not be found */ @Override public BookmarksEntry findByUuid_Last( String uuid, OrderByComparator orderByComparator) throws NoSuchEntryException { BookmarksEntry bookmarksEntry = fetchByUuid_Last( uuid, orderByComparator); if (bookmarksEntry != null) { return bookmarksEntry; } StringBundler sb = new StringBundler(4); sb.append(_NO_SUCH_ENTITY_WITH_KEY); sb.append("uuid="); sb.append(uuid); sb.append("}"); throw new NoSuchEntryException(sb.toString()); } /** * Returns the last bookmarks entry in the ordered set where uuid = ?. * * @param uuid the uuid * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching bookmarks entry, or null if a matching bookmarks entry could not be found */ @Override public BookmarksEntry fetchByUuid_Last( String uuid, OrderByComparator orderByComparator) { int count = countByUuid(uuid); if (count == 0) { return null; } List list = findByUuid( uuid, count - 1, count, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the bookmarks entries before and after the current bookmarks entry in the ordered set where uuid = ?. * * @param entryId the primary key of the current bookmarks entry * @param uuid the uuid * @param orderByComparator the comparator to order the set by (optionally null) * @return the previous, current, and next bookmarks entry * @throws NoSuchEntryException if a bookmarks entry with the primary key could not be found */ @Override public BookmarksEntry[] findByUuid_PrevAndNext( long entryId, String uuid, OrderByComparator orderByComparator) throws NoSuchEntryException { uuid = Objects.toString(uuid, ""); BookmarksEntry bookmarksEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BookmarksEntry[] array = new BookmarksEntryImpl[3]; array[0] = getByUuid_PrevAndNext( session, bookmarksEntry, uuid, orderByComparator, true); array[1] = bookmarksEntry; array[2] = getByUuid_PrevAndNext( session, bookmarksEntry, uuid, orderByComparator, false); return array; } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } protected BookmarksEntry getByUuid_PrevAndNext( Session session, BookmarksEntry bookmarksEntry, String uuid, OrderByComparator orderByComparator, boolean previous) { StringBundler sb = null; if (orderByComparator != null) { sb = new StringBundler( 4 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { sb = new StringBundler(3); } sb.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE); boolean bindUuid = false; if (uuid.isEmpty()) { sb.append(_FINDER_COLUMN_UUID_UUID_3); } else { bindUuid = true; sb.append(_FINDER_COLUMN_UUID_UUID_2); } if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { sb.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { sb.append(_ORDER_BY_ENTITY_ALIAS); sb.append(orderByConditionFields[i]); if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { sb.append(WHERE_GREATER_THAN_HAS_NEXT); } else { sb.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { sb.append(WHERE_GREATER_THAN); } else { sb.append(WHERE_LESSER_THAN); } } } sb.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { sb.append(_ORDER_BY_ENTITY_ALIAS); sb.append(orderByFields[i]); if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { sb.append(ORDER_BY_ASC_HAS_NEXT); } else { sb.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { sb.append(ORDER_BY_ASC); } else { sb.append(ORDER_BY_DESC); } } } } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_JPQL); } String sql = sb.toString(); Query query = session.createQuery(sql); query.setFirstResult(0); query.setMaxResults(2); QueryPos queryPos = QueryPos.getInstance(query); if (bindUuid) { queryPos.add(uuid); } if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues( bookmarksEntry)) { queryPos.add(orderByConditionValue); } } List list = query.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Removes all the bookmarks entries where uuid = ? from the database. * * @param uuid the uuid */ @Override public void removeByUuid(String uuid) { for (BookmarksEntry bookmarksEntry : findByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(bookmarksEntry); } } /** * Returns the number of bookmarks entries where uuid = ?. * * @param uuid the uuid * @return the number of matching bookmarks entries */ @Override public int countByUuid(String uuid) { try (SafeCloseable safeCloseable = ctPersistenceHelper.setCTCollectionIdWithSafeCloseable( BookmarksEntry.class)) { uuid = Objects.toString(uuid, ""); FinderPath finderPath = _finderPathCountByUuid; Object[] finderArgs = new Object[] {uuid}; Long count = (Long)finderCache.getResult( finderPath, finderArgs, this); if (count == null) { StringBundler sb = new StringBundler(2); sb.append(_SQL_COUNT_BOOKMARKSENTRY_WHERE); boolean bindUuid = false; if (uuid.isEmpty()) { sb.append(_FINDER_COLUMN_UUID_UUID_3); } else { bindUuid = true; sb.append(_FINDER_COLUMN_UUID_UUID_2); } String sql = sb.toString(); Session session = null; try { session = openSession(); Query query = session.createQuery(sql); QueryPos queryPos = QueryPos.getInstance(query); if (bindUuid) { queryPos.add(uuid); } count = (Long)query.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } return count.intValue(); } } private static final String _FINDER_COLUMN_UUID_UUID_2 = "bookmarksEntry.uuid = ?"; private static final String _FINDER_COLUMN_UUID_UUID_3 = "(bookmarksEntry.uuid IS NULL OR bookmarksEntry.uuid = '')"; private FinderPath _finderPathFetchByUUID_G; private FinderPath _finderPathCountByUUID_G; /** * Returns the bookmarks entry where uuid = ? and groupId = ? or throws a NoSuchEntryException if it could not be found. * * @param uuid the uuid * @param groupId the group ID * @return the matching bookmarks entry * @throws NoSuchEntryException if a matching bookmarks entry could not be found */ @Override public BookmarksEntry findByUUID_G(String uuid, long groupId) throws NoSuchEntryException { BookmarksEntry bookmarksEntry = fetchByUUID_G(uuid, groupId); if (bookmarksEntry == null) { StringBundler sb = new StringBundler(6); sb.append(_NO_SUCH_ENTITY_WITH_KEY); sb.append("uuid="); sb.append(uuid); sb.append(", groupId="); sb.append(groupId); sb.append("}"); if (_log.isDebugEnabled()) { _log.debug(sb.toString()); } throw new NoSuchEntryException(sb.toString()); } return bookmarksEntry; } /** * Returns the bookmarks entry where uuid = ? and groupId = ? or returns null if it could not be found. Uses the finder cache. * * @param uuid the uuid * @param groupId the group ID * @return the matching bookmarks entry, or null if a matching bookmarks entry could not be found */ @Override public BookmarksEntry fetchByUUID_G(String uuid, long groupId) { return fetchByUUID_G(uuid, groupId, true); } /** * Returns the bookmarks entry where uuid = ? and groupId = ? or returns null if it could not be found, optionally using the finder cache. * * @param uuid the uuid * @param groupId the group ID * @param useFinderCache whether to use the finder cache * @return the matching bookmarks entry, or null if a matching bookmarks entry could not be found */ @Override public BookmarksEntry fetchByUUID_G( String uuid, long groupId, boolean useFinderCache) { try (SafeCloseable safeCloseable = ctPersistenceHelper.setCTCollectionIdWithSafeCloseable( BookmarksEntry.class)) { uuid = Objects.toString(uuid, ""); Object[] finderArgs = null; if (useFinderCache) { finderArgs = new Object[] {uuid, groupId}; } Object result = null; if (useFinderCache) { result = finderCache.getResult( _finderPathFetchByUUID_G, finderArgs, this); } if (result instanceof BookmarksEntry) { BookmarksEntry bookmarksEntry = (BookmarksEntry)result; if (!Objects.equals(uuid, bookmarksEntry.getUuid()) || (groupId != bookmarksEntry.getGroupId())) { result = null; } } if (result == null) { StringBundler sb = new StringBundler(4); sb.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE); boolean bindUuid = false; if (uuid.isEmpty()) { sb.append(_FINDER_COLUMN_UUID_G_UUID_3); } else { bindUuid = true; sb.append(_FINDER_COLUMN_UUID_G_UUID_2); } sb.append(_FINDER_COLUMN_UUID_G_GROUPID_2); String sql = sb.toString(); Session session = null; try { session = openSession(); Query query = session.createQuery(sql); QueryPos queryPos = QueryPos.getInstance(query); if (bindUuid) { queryPos.add(uuid); } queryPos.add(groupId); List list = query.list(); if (list.isEmpty()) { if (useFinderCache) { finderCache.putResult( _finderPathFetchByUUID_G, finderArgs, list); } } else { BookmarksEntry bookmarksEntry = list.get(0); result = bookmarksEntry; cacheResult(bookmarksEntry); } } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } if (result instanceof List) { return null; } else { return (BookmarksEntry)result; } } } /** * Removes the bookmarks entry where uuid = ? and groupId = ? from the database. * * @param uuid the uuid * @param groupId the group ID * @return the bookmarks entry that was removed */ @Override public BookmarksEntry removeByUUID_G(String uuid, long groupId) throws NoSuchEntryException { BookmarksEntry bookmarksEntry = findByUUID_G(uuid, groupId); return remove(bookmarksEntry); } /** * Returns the number of bookmarks entries where uuid = ? and groupId = ?. * * @param uuid the uuid * @param groupId the group ID * @return the number of matching bookmarks entries */ @Override public int countByUUID_G(String uuid, long groupId) { try (SafeCloseable safeCloseable = ctPersistenceHelper.setCTCollectionIdWithSafeCloseable( BookmarksEntry.class)) { uuid = Objects.toString(uuid, ""); FinderPath finderPath = _finderPathCountByUUID_G; Object[] finderArgs = new Object[] {uuid, groupId}; Long count = (Long)finderCache.getResult( finderPath, finderArgs, this); if (count == null) { StringBundler sb = new StringBundler(3); sb.append(_SQL_COUNT_BOOKMARKSENTRY_WHERE); boolean bindUuid = false; if (uuid.isEmpty()) { sb.append(_FINDER_COLUMN_UUID_G_UUID_3); } else { bindUuid = true; sb.append(_FINDER_COLUMN_UUID_G_UUID_2); } sb.append(_FINDER_COLUMN_UUID_G_GROUPID_2); String sql = sb.toString(); Session session = null; try { session = openSession(); Query query = session.createQuery(sql); QueryPos queryPos = QueryPos.getInstance(query); if (bindUuid) { queryPos.add(uuid); } queryPos.add(groupId); count = (Long)query.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } return count.intValue(); } } private static final String _FINDER_COLUMN_UUID_G_UUID_2 = "bookmarksEntry.uuid = ? AND "; private static final String _FINDER_COLUMN_UUID_G_UUID_3 = "(bookmarksEntry.uuid IS NULL OR bookmarksEntry.uuid = '') AND "; private static final String _FINDER_COLUMN_UUID_G_GROUPID_2 = "bookmarksEntry.groupId = ?"; private FinderPath _finderPathWithPaginationFindByUuid_C; private FinderPath _finderPathWithoutPaginationFindByUuid_C; private FinderPath _finderPathCountByUuid_C; /** * Returns all the bookmarks entries where uuid = ? and companyId = ?. * * @param uuid the uuid * @param companyId the company ID * @return the matching bookmarks entries */ @Override public List findByUuid_C(String uuid, long companyId) { return findByUuid_C( uuid, companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the bookmarks entries where uuid = ? and companyId = ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param uuid the uuid * @param companyId the company ID * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @return the range of matching bookmarks entries */ @Override public List findByUuid_C( String uuid, long companyId, int start, int end) { return findByUuid_C(uuid, companyId, start, end, null); } /** * Returns an ordered range of all the bookmarks entries where uuid = ? and companyId = ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param uuid the uuid * @param companyId the company ID * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching bookmarks entries */ @Override public List findByUuid_C( String uuid, long companyId, int start, int end, OrderByComparator orderByComparator) { return findByUuid_C( uuid, companyId, start, end, orderByComparator, true); } /** * Returns an ordered range of all the bookmarks entries where uuid = ? and companyId = ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param uuid the uuid * @param companyId the company ID * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @param useFinderCache whether to use the finder cache * @return the ordered range of matching bookmarks entries */ @Override public List findByUuid_C( String uuid, long companyId, int start, int end, OrderByComparator orderByComparator, boolean useFinderCache) { try (SafeCloseable safeCloseable = ctPersistenceHelper.setCTCollectionIdWithSafeCloseable( BookmarksEntry.class)) { uuid = Objects.toString(uuid, ""); FinderPath finderPath = null; Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { if (useFinderCache) { finderPath = _finderPathWithoutPaginationFindByUuid_C; finderArgs = new Object[] {uuid, companyId}; } } else if (useFinderCache) { finderPath = _finderPathWithPaginationFindByUuid_C; finderArgs = new Object[] { uuid, companyId, start, end, orderByComparator }; } List list = null; if (useFinderCache) { list = (List)finderCache.getResult( finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (BookmarksEntry bookmarksEntry : list) { if (!uuid.equals(bookmarksEntry.getUuid()) || (companyId != bookmarksEntry.getCompanyId())) { list = null; break; } } } } if (list == null) { StringBundler sb = null; if (orderByComparator != null) { sb = new StringBundler( 4 + (orderByComparator.getOrderByFields().length * 2)); } else { sb = new StringBundler(4); } sb.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE); boolean bindUuid = false; if (uuid.isEmpty()) { sb.append(_FINDER_COLUMN_UUID_C_UUID_3); } else { bindUuid = true; sb.append(_FINDER_COLUMN_UUID_C_UUID_2); } sb.append(_FINDER_COLUMN_UUID_C_COMPANYID_2); if (orderByComparator != null) { appendOrderByComparator( sb, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_JPQL); } String sql = sb.toString(); Session session = null; try { session = openSession(); Query query = session.createQuery(sql); QueryPos queryPos = QueryPos.getInstance(query); if (bindUuid) { queryPos.add(uuid); } queryPos.add(companyId); list = (List)QueryUtil.list( query, getDialect(), start, end); cacheResult(list); if (useFinderCache) { finderCache.putResult(finderPath, finderArgs, list); } } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } return list; } } /** * Returns the first bookmarks entry in the ordered set where uuid = ? and companyId = ?. * * @param uuid the uuid * @param companyId the company ID * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching bookmarks entry * @throws NoSuchEntryException if a matching bookmarks entry could not be found */ @Override public BookmarksEntry findByUuid_C_First( String uuid, long companyId, OrderByComparator orderByComparator) throws NoSuchEntryException { BookmarksEntry bookmarksEntry = fetchByUuid_C_First( uuid, companyId, orderByComparator); if (bookmarksEntry != null) { return bookmarksEntry; } StringBundler sb = new StringBundler(6); sb.append(_NO_SUCH_ENTITY_WITH_KEY); sb.append("uuid="); sb.append(uuid); sb.append(", companyId="); sb.append(companyId); sb.append("}"); throw new NoSuchEntryException(sb.toString()); } /** * Returns the first bookmarks entry in the ordered set where uuid = ? and companyId = ?. * * @param uuid the uuid * @param companyId the company ID * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching bookmarks entry, or null if a matching bookmarks entry could not be found */ @Override public BookmarksEntry fetchByUuid_C_First( String uuid, long companyId, OrderByComparator orderByComparator) { List list = findByUuid_C( uuid, companyId, 0, 1, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the last bookmarks entry in the ordered set where uuid = ? and companyId = ?. * * @param uuid the uuid * @param companyId the company ID * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching bookmarks entry * @throws NoSuchEntryException if a matching bookmarks entry could not be found */ @Override public BookmarksEntry findByUuid_C_Last( String uuid, long companyId, OrderByComparator orderByComparator) throws NoSuchEntryException { BookmarksEntry bookmarksEntry = fetchByUuid_C_Last( uuid, companyId, orderByComparator); if (bookmarksEntry != null) { return bookmarksEntry; } StringBundler sb = new StringBundler(6); sb.append(_NO_SUCH_ENTITY_WITH_KEY); sb.append("uuid="); sb.append(uuid); sb.append(", companyId="); sb.append(companyId); sb.append("}"); throw new NoSuchEntryException(sb.toString()); } /** * Returns the last bookmarks entry in the ordered set where uuid = ? and companyId = ?. * * @param uuid the uuid * @param companyId the company ID * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching bookmarks entry, or null if a matching bookmarks entry could not be found */ @Override public BookmarksEntry fetchByUuid_C_Last( String uuid, long companyId, OrderByComparator orderByComparator) { int count = countByUuid_C(uuid, companyId); if (count == 0) { return null; } List list = findByUuid_C( uuid, companyId, count - 1, count, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the bookmarks entries before and after the current bookmarks entry in the ordered set where uuid = ? and companyId = ?. * * @param entryId the primary key of the current bookmarks entry * @param uuid the uuid * @param companyId the company ID * @param orderByComparator the comparator to order the set by (optionally null) * @return the previous, current, and next bookmarks entry * @throws NoSuchEntryException if a bookmarks entry with the primary key could not be found */ @Override public BookmarksEntry[] findByUuid_C_PrevAndNext( long entryId, String uuid, long companyId, OrderByComparator orderByComparator) throws NoSuchEntryException { uuid = Objects.toString(uuid, ""); BookmarksEntry bookmarksEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BookmarksEntry[] array = new BookmarksEntryImpl[3]; array[0] = getByUuid_C_PrevAndNext( session, bookmarksEntry, uuid, companyId, orderByComparator, true); array[1] = bookmarksEntry; array[2] = getByUuid_C_PrevAndNext( session, bookmarksEntry, uuid, companyId, orderByComparator, false); return array; } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } protected BookmarksEntry getByUuid_C_PrevAndNext( Session session, BookmarksEntry bookmarksEntry, String uuid, long companyId, OrderByComparator orderByComparator, boolean previous) { StringBundler sb = null; if (orderByComparator != null) { sb = new StringBundler( 5 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { sb = new StringBundler(4); } sb.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE); boolean bindUuid = false; if (uuid.isEmpty()) { sb.append(_FINDER_COLUMN_UUID_C_UUID_3); } else { bindUuid = true; sb.append(_FINDER_COLUMN_UUID_C_UUID_2); } sb.append(_FINDER_COLUMN_UUID_C_COMPANYID_2); if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { sb.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { sb.append(_ORDER_BY_ENTITY_ALIAS); sb.append(orderByConditionFields[i]); if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { sb.append(WHERE_GREATER_THAN_HAS_NEXT); } else { sb.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { sb.append(WHERE_GREATER_THAN); } else { sb.append(WHERE_LESSER_THAN); } } } sb.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { sb.append(_ORDER_BY_ENTITY_ALIAS); sb.append(orderByFields[i]); if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { sb.append(ORDER_BY_ASC_HAS_NEXT); } else { sb.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { sb.append(ORDER_BY_ASC); } else { sb.append(ORDER_BY_DESC); } } } } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_JPQL); } String sql = sb.toString(); Query query = session.createQuery(sql); query.setFirstResult(0); query.setMaxResults(2); QueryPos queryPos = QueryPos.getInstance(query); if (bindUuid) { queryPos.add(uuid); } queryPos.add(companyId); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues( bookmarksEntry)) { queryPos.add(orderByConditionValue); } } List list = query.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Removes all the bookmarks entries where uuid = ? and companyId = ? from the database. * * @param uuid the uuid * @param companyId the company ID */ @Override public void removeByUuid_C(String uuid, long companyId) { for (BookmarksEntry bookmarksEntry : findByUuid_C( uuid, companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(bookmarksEntry); } } /** * Returns the number of bookmarks entries where uuid = ? and companyId = ?. * * @param uuid the uuid * @param companyId the company ID * @return the number of matching bookmarks entries */ @Override public int countByUuid_C(String uuid, long companyId) { try (SafeCloseable safeCloseable = ctPersistenceHelper.setCTCollectionIdWithSafeCloseable( BookmarksEntry.class)) { uuid = Objects.toString(uuid, ""); FinderPath finderPath = _finderPathCountByUuid_C; Object[] finderArgs = new Object[] {uuid, companyId}; Long count = (Long)finderCache.getResult( finderPath, finderArgs, this); if (count == null) { StringBundler sb = new StringBundler(3); sb.append(_SQL_COUNT_BOOKMARKSENTRY_WHERE); boolean bindUuid = false; if (uuid.isEmpty()) { sb.append(_FINDER_COLUMN_UUID_C_UUID_3); } else { bindUuid = true; sb.append(_FINDER_COLUMN_UUID_C_UUID_2); } sb.append(_FINDER_COLUMN_UUID_C_COMPANYID_2); String sql = sb.toString(); Session session = null; try { session = openSession(); Query query = session.createQuery(sql); QueryPos queryPos = QueryPos.getInstance(query); if (bindUuid) { queryPos.add(uuid); } queryPos.add(companyId); count = (Long)query.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } return count.intValue(); } } private static final String _FINDER_COLUMN_UUID_C_UUID_2 = "bookmarksEntry.uuid = ? AND "; private static final String _FINDER_COLUMN_UUID_C_UUID_3 = "(bookmarksEntry.uuid IS NULL OR bookmarksEntry.uuid = '') AND "; private static final String _FINDER_COLUMN_UUID_C_COMPANYID_2 = "bookmarksEntry.companyId = ?"; private FinderPath _finderPathWithPaginationFindByCompanyId; private FinderPath _finderPathWithoutPaginationFindByCompanyId; private FinderPath _finderPathCountByCompanyId; /** * Returns all the bookmarks entries where companyId = ?. * * @param companyId the company ID * @return the matching bookmarks entries */ @Override public List findByCompanyId(long companyId) { return findByCompanyId( companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the bookmarks entries where companyId = ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param companyId the company ID * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @return the range of matching bookmarks entries */ @Override public List findByCompanyId( long companyId, int start, int end) { return findByCompanyId(companyId, start, end, null); } /** * Returns an ordered range of all the bookmarks entries where companyId = ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param companyId the company ID * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching bookmarks entries */ @Override public List findByCompanyId( long companyId, int start, int end, OrderByComparator orderByComparator) { return findByCompanyId(companyId, start, end, orderByComparator, true); } /** * Returns an ordered range of all the bookmarks entries where companyId = ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param companyId the company ID * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @param useFinderCache whether to use the finder cache * @return the ordered range of matching bookmarks entries */ @Override public List findByCompanyId( long companyId, int start, int end, OrderByComparator orderByComparator, boolean useFinderCache) { try (SafeCloseable safeCloseable = ctPersistenceHelper.setCTCollectionIdWithSafeCloseable( BookmarksEntry.class)) { FinderPath finderPath = null; Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { if (useFinderCache) { finderPath = _finderPathWithoutPaginationFindByCompanyId; finderArgs = new Object[] {companyId}; } } else if (useFinderCache) { finderPath = _finderPathWithPaginationFindByCompanyId; finderArgs = new Object[] { companyId, start, end, orderByComparator }; } List list = null; if (useFinderCache) { list = (List)finderCache.getResult( finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (BookmarksEntry bookmarksEntry : list) { if (companyId != bookmarksEntry.getCompanyId()) { list = null; break; } } } } if (list == null) { StringBundler sb = null; if (orderByComparator != null) { sb = new StringBundler( 3 + (orderByComparator.getOrderByFields().length * 2)); } else { sb = new StringBundler(3); } sb.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2); if (orderByComparator != null) { appendOrderByComparator( sb, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_JPQL); } String sql = sb.toString(); Session session = null; try { session = openSession(); Query query = session.createQuery(sql); QueryPos queryPos = QueryPos.getInstance(query); queryPos.add(companyId); list = (List)QueryUtil.list( query, getDialect(), start, end); cacheResult(list); if (useFinderCache) { finderCache.putResult(finderPath, finderArgs, list); } } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } return list; } } /** * Returns the first bookmarks entry in the ordered set where companyId = ?. * * @param companyId the company ID * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching bookmarks entry * @throws NoSuchEntryException if a matching bookmarks entry could not be found */ @Override public BookmarksEntry findByCompanyId_First( long companyId, OrderByComparator orderByComparator) throws NoSuchEntryException { BookmarksEntry bookmarksEntry = fetchByCompanyId_First( companyId, orderByComparator); if (bookmarksEntry != null) { return bookmarksEntry; } StringBundler sb = new StringBundler(4); sb.append(_NO_SUCH_ENTITY_WITH_KEY); sb.append("companyId="); sb.append(companyId); sb.append("}"); throw new NoSuchEntryException(sb.toString()); } /** * Returns the first bookmarks entry in the ordered set where companyId = ?. * * @param companyId the company ID * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching bookmarks entry, or null if a matching bookmarks entry could not be found */ @Override public BookmarksEntry fetchByCompanyId_First( long companyId, OrderByComparator orderByComparator) { List list = findByCompanyId( companyId, 0, 1, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the last bookmarks entry in the ordered set where companyId = ?. * * @param companyId the company ID * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching bookmarks entry * @throws NoSuchEntryException if a matching bookmarks entry could not be found */ @Override public BookmarksEntry findByCompanyId_Last( long companyId, OrderByComparator orderByComparator) throws NoSuchEntryException { BookmarksEntry bookmarksEntry = fetchByCompanyId_Last( companyId, orderByComparator); if (bookmarksEntry != null) { return bookmarksEntry; } StringBundler sb = new StringBundler(4); sb.append(_NO_SUCH_ENTITY_WITH_KEY); sb.append("companyId="); sb.append(companyId); sb.append("}"); throw new NoSuchEntryException(sb.toString()); } /** * Returns the last bookmarks entry in the ordered set where companyId = ?. * * @param companyId the company ID * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching bookmarks entry, or null if a matching bookmarks entry could not be found */ @Override public BookmarksEntry fetchByCompanyId_Last( long companyId, OrderByComparator orderByComparator) { int count = countByCompanyId(companyId); if (count == 0) { return null; } List list = findByCompanyId( companyId, count - 1, count, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the bookmarks entries before and after the current bookmarks entry in the ordered set where companyId = ?. * * @param entryId the primary key of the current bookmarks entry * @param companyId the company ID * @param orderByComparator the comparator to order the set by (optionally null) * @return the previous, current, and next bookmarks entry * @throws NoSuchEntryException if a bookmarks entry with the primary key could not be found */ @Override public BookmarksEntry[] findByCompanyId_PrevAndNext( long entryId, long companyId, OrderByComparator orderByComparator) throws NoSuchEntryException { BookmarksEntry bookmarksEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BookmarksEntry[] array = new BookmarksEntryImpl[3]; array[0] = getByCompanyId_PrevAndNext( session, bookmarksEntry, companyId, orderByComparator, true); array[1] = bookmarksEntry; array[2] = getByCompanyId_PrevAndNext( session, bookmarksEntry, companyId, orderByComparator, false); return array; } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } protected BookmarksEntry getByCompanyId_PrevAndNext( Session session, BookmarksEntry bookmarksEntry, long companyId, OrderByComparator orderByComparator, boolean previous) { StringBundler sb = null; if (orderByComparator != null) { sb = new StringBundler( 4 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { sb = new StringBundler(3); } sb.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2); if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { sb.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { sb.append(_ORDER_BY_ENTITY_ALIAS); sb.append(orderByConditionFields[i]); if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { sb.append(WHERE_GREATER_THAN_HAS_NEXT); } else { sb.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { sb.append(WHERE_GREATER_THAN); } else { sb.append(WHERE_LESSER_THAN); } } } sb.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { sb.append(_ORDER_BY_ENTITY_ALIAS); sb.append(orderByFields[i]); if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { sb.append(ORDER_BY_ASC_HAS_NEXT); } else { sb.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { sb.append(ORDER_BY_ASC); } else { sb.append(ORDER_BY_DESC); } } } } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_JPQL); } String sql = sb.toString(); Query query = session.createQuery(sql); query.setFirstResult(0); query.setMaxResults(2); QueryPos queryPos = QueryPos.getInstance(query); queryPos.add(companyId); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues( bookmarksEntry)) { queryPos.add(orderByConditionValue); } } List list = query.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Removes all the bookmarks entries where companyId = ? from the database. * * @param companyId the company ID */ @Override public void removeByCompanyId(long companyId) { for (BookmarksEntry bookmarksEntry : findByCompanyId( companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(bookmarksEntry); } } /** * Returns the number of bookmarks entries where companyId = ?. * * @param companyId the company ID * @return the number of matching bookmarks entries */ @Override public int countByCompanyId(long companyId) { try (SafeCloseable safeCloseable = ctPersistenceHelper.setCTCollectionIdWithSafeCloseable( BookmarksEntry.class)) { FinderPath finderPath = _finderPathCountByCompanyId; Object[] finderArgs = new Object[] {companyId}; Long count = (Long)finderCache.getResult( finderPath, finderArgs, this); if (count == null) { StringBundler sb = new StringBundler(2); sb.append(_SQL_COUNT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2); String sql = sb.toString(); Session session = null; try { session = openSession(); Query query = session.createQuery(sql); QueryPos queryPos = QueryPos.getInstance(query); queryPos.add(companyId); count = (Long)query.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } return count.intValue(); } } private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "bookmarksEntry.companyId = ?"; private FinderPath _finderPathWithPaginationFindByG_F; private FinderPath _finderPathWithoutPaginationFindByG_F; private FinderPath _finderPathCountByG_F; private FinderPath _finderPathWithPaginationCountByG_F; /** * Returns all the bookmarks entries where groupId = ? and folderId = ?. * * @param groupId the group ID * @param folderId the folder ID * @return the matching bookmarks entries */ @Override public List findByG_F(long groupId, long folderId) { return findByG_F( groupId, folderId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the bookmarks entries where groupId = ? and folderId = ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param folderId the folder ID * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @return the range of matching bookmarks entries */ @Override public List findByG_F( long groupId, long folderId, int start, int end) { return findByG_F(groupId, folderId, start, end, null); } /** * Returns an ordered range of all the bookmarks entries where groupId = ? and folderId = ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param folderId the folder ID * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching bookmarks entries */ @Override public List findByG_F( long groupId, long folderId, int start, int end, OrderByComparator orderByComparator) { return findByG_F( groupId, folderId, start, end, orderByComparator, true); } /** * Returns an ordered range of all the bookmarks entries where groupId = ? and folderId = ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param folderId the folder ID * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @param useFinderCache whether to use the finder cache * @return the ordered range of matching bookmarks entries */ @Override public List findByG_F( long groupId, long folderId, int start, int end, OrderByComparator orderByComparator, boolean useFinderCache) { try (SafeCloseable safeCloseable = ctPersistenceHelper.setCTCollectionIdWithSafeCloseable( BookmarksEntry.class)) { FinderPath finderPath = null; Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { if (useFinderCache) { finderPath = _finderPathWithoutPaginationFindByG_F; finderArgs = new Object[] {groupId, folderId}; } } else if (useFinderCache) { finderPath = _finderPathWithPaginationFindByG_F; finderArgs = new Object[] { groupId, folderId, start, end, orderByComparator }; } List list = null; if (useFinderCache) { list = (List)finderCache.getResult( finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (BookmarksEntry bookmarksEntry : list) { if ((groupId != bookmarksEntry.getGroupId()) || (folderId != bookmarksEntry.getFolderId())) { list = null; break; } } } } if (list == null) { StringBundler sb = null; if (orderByComparator != null) { sb = new StringBundler( 4 + (orderByComparator.getOrderByFields().length * 2)); } else { sb = new StringBundler(4); } sb.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_G_F_GROUPID_2); sb.append(_FINDER_COLUMN_G_F_FOLDERID_2); if (orderByComparator != null) { appendOrderByComparator( sb, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_JPQL); } String sql = sb.toString(); Session session = null; try { session = openSession(); Query query = session.createQuery(sql); QueryPos queryPos = QueryPos.getInstance(query); queryPos.add(groupId); queryPos.add(folderId); list = (List)QueryUtil.list( query, getDialect(), start, end); cacheResult(list); if (useFinderCache) { finderCache.putResult(finderPath, finderArgs, list); } } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } return list; } } /** * Returns the first bookmarks entry in the ordered set where groupId = ? and folderId = ?. * * @param groupId the group ID * @param folderId the folder ID * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching bookmarks entry * @throws NoSuchEntryException if a matching bookmarks entry could not be found */ @Override public BookmarksEntry findByG_F_First( long groupId, long folderId, OrderByComparator orderByComparator) throws NoSuchEntryException { BookmarksEntry bookmarksEntry = fetchByG_F_First( groupId, folderId, orderByComparator); if (bookmarksEntry != null) { return bookmarksEntry; } StringBundler sb = new StringBundler(6); sb.append(_NO_SUCH_ENTITY_WITH_KEY); sb.append("groupId="); sb.append(groupId); sb.append(", folderId="); sb.append(folderId); sb.append("}"); throw new NoSuchEntryException(sb.toString()); } /** * Returns the first bookmarks entry in the ordered set where groupId = ? and folderId = ?. * * @param groupId the group ID * @param folderId the folder ID * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching bookmarks entry, or null if a matching bookmarks entry could not be found */ @Override public BookmarksEntry fetchByG_F_First( long groupId, long folderId, OrderByComparator orderByComparator) { List list = findByG_F( groupId, folderId, 0, 1, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the last bookmarks entry in the ordered set where groupId = ? and folderId = ?. * * @param groupId the group ID * @param folderId the folder ID * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching bookmarks entry * @throws NoSuchEntryException if a matching bookmarks entry could not be found */ @Override public BookmarksEntry findByG_F_Last( long groupId, long folderId, OrderByComparator orderByComparator) throws NoSuchEntryException { BookmarksEntry bookmarksEntry = fetchByG_F_Last( groupId, folderId, orderByComparator); if (bookmarksEntry != null) { return bookmarksEntry; } StringBundler sb = new StringBundler(6); sb.append(_NO_SUCH_ENTITY_WITH_KEY); sb.append("groupId="); sb.append(groupId); sb.append(", folderId="); sb.append(folderId); sb.append("}"); throw new NoSuchEntryException(sb.toString()); } /** * Returns the last bookmarks entry in the ordered set where groupId = ? and folderId = ?. * * @param groupId the group ID * @param folderId the folder ID * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching bookmarks entry, or null if a matching bookmarks entry could not be found */ @Override public BookmarksEntry fetchByG_F_Last( long groupId, long folderId, OrderByComparator orderByComparator) { int count = countByG_F(groupId, folderId); if (count == 0) { return null; } List list = findByG_F( groupId, folderId, count - 1, count, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the bookmarks entries before and after the current bookmarks entry in the ordered set where groupId = ? and folderId = ?. * * @param entryId the primary key of the current bookmarks entry * @param groupId the group ID * @param folderId the folder ID * @param orderByComparator the comparator to order the set by (optionally null) * @return the previous, current, and next bookmarks entry * @throws NoSuchEntryException if a bookmarks entry with the primary key could not be found */ @Override public BookmarksEntry[] findByG_F_PrevAndNext( long entryId, long groupId, long folderId, OrderByComparator orderByComparator) throws NoSuchEntryException { BookmarksEntry bookmarksEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BookmarksEntry[] array = new BookmarksEntryImpl[3]; array[0] = getByG_F_PrevAndNext( session, bookmarksEntry, groupId, folderId, orderByComparator, true); array[1] = bookmarksEntry; array[2] = getByG_F_PrevAndNext( session, bookmarksEntry, groupId, folderId, orderByComparator, false); return array; } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } protected BookmarksEntry getByG_F_PrevAndNext( Session session, BookmarksEntry bookmarksEntry, long groupId, long folderId, OrderByComparator orderByComparator, boolean previous) { StringBundler sb = null; if (orderByComparator != null) { sb = new StringBundler( 5 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { sb = new StringBundler(4); } sb.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_G_F_GROUPID_2); sb.append(_FINDER_COLUMN_G_F_FOLDERID_2); if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { sb.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { sb.append(_ORDER_BY_ENTITY_ALIAS); sb.append(orderByConditionFields[i]); if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { sb.append(WHERE_GREATER_THAN_HAS_NEXT); } else { sb.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { sb.append(WHERE_GREATER_THAN); } else { sb.append(WHERE_LESSER_THAN); } } } sb.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { sb.append(_ORDER_BY_ENTITY_ALIAS); sb.append(orderByFields[i]); if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { sb.append(ORDER_BY_ASC_HAS_NEXT); } else { sb.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { sb.append(ORDER_BY_ASC); } else { sb.append(ORDER_BY_DESC); } } } } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_JPQL); } String sql = sb.toString(); Query query = session.createQuery(sql); query.setFirstResult(0); query.setMaxResults(2); QueryPos queryPos = QueryPos.getInstance(query); queryPos.add(groupId); queryPos.add(folderId); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues( bookmarksEntry)) { queryPos.add(orderByConditionValue); } } List list = query.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Returns all the bookmarks entries that the user has permission to view where groupId = ? and folderId = ?. * * @param groupId the group ID * @param folderId the folder ID * @return the matching bookmarks entries that the user has permission to view */ @Override public List filterFindByG_F(long groupId, long folderId) { return filterFindByG_F( groupId, folderId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the bookmarks entries that the user has permission to view where groupId = ? and folderId = ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param folderId the folder ID * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @return the range of matching bookmarks entries that the user has permission to view */ @Override public List filterFindByG_F( long groupId, long folderId, int start, int end) { return filterFindByG_F(groupId, folderId, start, end, null); } /** * Returns an ordered range of all the bookmarks entries that the user has permissions to view where groupId = ? and folderId = ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param folderId the folder ID * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching bookmarks entries that the user has permission to view */ @Override public List filterFindByG_F( long groupId, long folderId, int start, int end, OrderByComparator orderByComparator) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByG_F(groupId, folderId, start, end, orderByComparator); } StringBundler sb = null; if (orderByComparator != null) { sb = new StringBundler( 4 + (orderByComparator.getOrderByFields().length * 2)); } else { sb = new StringBundler(5); } if (getDB().isSupportsInlineDistinct()) { sb.append(_FILTER_SQL_SELECT_BOOKMARKSENTRY_WHERE); } else { sb.append( _FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_1); } sb.append(_FINDER_COLUMN_G_F_GROUPID_2); sb.append(_FINDER_COLUMN_G_F_FOLDERID_2); if (!getDB().isSupportsInlineDistinct()) { sb.append( _FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { if (getDB().isSupportsInlineDistinct()) { appendOrderByComparator( sb, _ORDER_BY_ENTITY_ALIAS, orderByComparator, true); } else { appendOrderByComparator( sb, _ORDER_BY_ENTITY_TABLE, orderByComparator, true); } } else { if (getDB().isSupportsInlineDistinct()) { sb.append(BookmarksEntryModelImpl.ORDER_BY_SQL_INLINE_DISTINCT); } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck( sb.toString(), BookmarksEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery sqlQuery = session.createSynchronizedSQLQuery(sql); if (getDB().isSupportsInlineDistinct()) { sqlQuery.addEntity( _FILTER_ENTITY_ALIAS, BookmarksEntryImpl.class); } else { sqlQuery.addEntity( _FILTER_ENTITY_TABLE, BookmarksEntryImpl.class); } QueryPos queryPos = QueryPos.getInstance(sqlQuery); queryPos.add(groupId); queryPos.add(folderId); return (List)QueryUtil.list( sqlQuery, getDialect(), start, end); } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } /** * Returns the bookmarks entries before and after the current bookmarks entry in the ordered set of bookmarks entries that the user has permission to view where groupId = ? and folderId = ?. * * @param entryId the primary key of the current bookmarks entry * @param groupId the group ID * @param folderId the folder ID * @param orderByComparator the comparator to order the set by (optionally null) * @return the previous, current, and next bookmarks entry * @throws NoSuchEntryException if a bookmarks entry with the primary key could not be found */ @Override public BookmarksEntry[] filterFindByG_F_PrevAndNext( long entryId, long groupId, long folderId, OrderByComparator orderByComparator) throws NoSuchEntryException { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByG_F_PrevAndNext( entryId, groupId, folderId, orderByComparator); } BookmarksEntry bookmarksEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BookmarksEntry[] array = new BookmarksEntryImpl[3]; array[0] = filterGetByG_F_PrevAndNext( session, bookmarksEntry, groupId, folderId, orderByComparator, true); array[1] = bookmarksEntry; array[2] = filterGetByG_F_PrevAndNext( session, bookmarksEntry, groupId, folderId, orderByComparator, false); return array; } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } protected BookmarksEntry filterGetByG_F_PrevAndNext( Session session, BookmarksEntry bookmarksEntry, long groupId, long folderId, OrderByComparator orderByComparator, boolean previous) { StringBundler sb = null; if (orderByComparator != null) { sb = new StringBundler( 6 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { sb = new StringBundler(5); } if (getDB().isSupportsInlineDistinct()) { sb.append(_FILTER_SQL_SELECT_BOOKMARKSENTRY_WHERE); } else { sb.append( _FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_1); } sb.append(_FINDER_COLUMN_G_F_GROUPID_2); sb.append(_FINDER_COLUMN_G_F_FOLDERID_2); if (!getDB().isSupportsInlineDistinct()) { sb.append( _FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { sb.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { if (getDB().isSupportsInlineDistinct()) { sb.append( getColumnName( _ORDER_BY_ENTITY_ALIAS, orderByConditionFields[i], true)); } else { sb.append( getColumnName( _ORDER_BY_ENTITY_TABLE, orderByConditionFields[i], true)); } if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { sb.append(WHERE_GREATER_THAN_HAS_NEXT); } else { sb.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { sb.append(WHERE_GREATER_THAN); } else { sb.append(WHERE_LESSER_THAN); } } } sb.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { if (getDB().isSupportsInlineDistinct()) { sb.append( getColumnName( _ORDER_BY_ENTITY_ALIAS, orderByFields[i], true)); } else { sb.append( getColumnName( _ORDER_BY_ENTITY_TABLE, orderByFields[i], true)); } if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { sb.append(ORDER_BY_ASC_HAS_NEXT); } else { sb.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { sb.append(ORDER_BY_ASC); } else { sb.append(ORDER_BY_DESC); } } } } else { if (getDB().isSupportsInlineDistinct()) { sb.append(BookmarksEntryModelImpl.ORDER_BY_SQL_INLINE_DISTINCT); } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck( sb.toString(), BookmarksEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); SQLQuery sqlQuery = session.createSynchronizedSQLQuery(sql); sqlQuery.setFirstResult(0); sqlQuery.setMaxResults(2); if (getDB().isSupportsInlineDistinct()) { sqlQuery.addEntity(_FILTER_ENTITY_ALIAS, BookmarksEntryImpl.class); } else { sqlQuery.addEntity(_FILTER_ENTITY_TABLE, BookmarksEntryImpl.class); } QueryPos queryPos = QueryPos.getInstance(sqlQuery); queryPos.add(groupId); queryPos.add(folderId); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues( bookmarksEntry)) { queryPos.add(orderByConditionValue); } } List list = sqlQuery.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Returns all the bookmarks entries that the user has permission to view where groupId = ? and folderId = any ?. * * @param groupId the group ID * @param folderIds the folder IDs * @return the matching bookmarks entries that the user has permission to view */ @Override public List filterFindByG_F( long groupId, long[] folderIds) { return filterFindByG_F( groupId, folderIds, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the bookmarks entries that the user has permission to view where groupId = ? and folderId = any ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param folderIds the folder IDs * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @return the range of matching bookmarks entries that the user has permission to view */ @Override public List filterFindByG_F( long groupId, long[] folderIds, int start, int end) { return filterFindByG_F(groupId, folderIds, start, end, null); } /** * Returns an ordered range of all the bookmarks entries that the user has permission to view where groupId = ? and folderId = any ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param folderIds the folder IDs * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching bookmarks entries that the user has permission to view */ @Override public List filterFindByG_F( long groupId, long[] folderIds, int start, int end, OrderByComparator orderByComparator) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByG_F(groupId, folderIds, start, end, orderByComparator); } if (folderIds == null) { folderIds = new long[0]; } else if (folderIds.length > 1) { folderIds = ArrayUtil.sortedUnique(folderIds); } StringBundler sb = new StringBundler(); if (getDB().isSupportsInlineDistinct()) { sb.append(_FILTER_SQL_SELECT_BOOKMARKSENTRY_WHERE); } else { sb.append( _FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_1); } sb.append(_FINDER_COLUMN_G_F_GROUPID_2); if (folderIds.length > 0) { sb.append("("); sb.append(_FINDER_COLUMN_G_F_FOLDERID_7); sb.append(StringUtil.merge(folderIds)); sb.append(")"); sb.append(")"); } sb.setStringAt( removeConjunction(sb.stringAt(sb.index() - 1)), sb.index() - 1); if (!getDB().isSupportsInlineDistinct()) { sb.append( _FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { if (getDB().isSupportsInlineDistinct()) { appendOrderByComparator( sb, _ORDER_BY_ENTITY_ALIAS, orderByComparator, true); } else { appendOrderByComparator( sb, _ORDER_BY_ENTITY_TABLE, orderByComparator, true); } } else { if (getDB().isSupportsInlineDistinct()) { sb.append(BookmarksEntryModelImpl.ORDER_BY_SQL_INLINE_DISTINCT); } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck( sb.toString(), BookmarksEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery sqlQuery = session.createSynchronizedSQLQuery(sql); if (getDB().isSupportsInlineDistinct()) { sqlQuery.addEntity( _FILTER_ENTITY_ALIAS, BookmarksEntryImpl.class); } else { sqlQuery.addEntity( _FILTER_ENTITY_TABLE, BookmarksEntryImpl.class); } QueryPos queryPos = QueryPos.getInstance(sqlQuery); queryPos.add(groupId); return (List)QueryUtil.list( sqlQuery, getDialect(), start, end); } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } /** * Returns all the bookmarks entries where groupId = ? and folderId = any ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param folderIds the folder IDs * @return the matching bookmarks entries */ @Override public List findByG_F(long groupId, long[] folderIds) { return findByG_F( groupId, folderIds, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the bookmarks entries where groupId = ? and folderId = any ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param folderIds the folder IDs * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @return the range of matching bookmarks entries */ @Override public List findByG_F( long groupId, long[] folderIds, int start, int end) { return findByG_F(groupId, folderIds, start, end, null); } /** * Returns an ordered range of all the bookmarks entries where groupId = ? and folderId = any ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param folderIds the folder IDs * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching bookmarks entries */ @Override public List findByG_F( long groupId, long[] folderIds, int start, int end, OrderByComparator orderByComparator) { return findByG_F( groupId, folderIds, start, end, orderByComparator, true); } /** * Returns an ordered range of all the bookmarks entries where groupId = ? and folderId = ?, optionally using the finder cache. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param folderIds the folder IDs * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @param useFinderCache whether to use the finder cache * @return the ordered range of matching bookmarks entries */ @Override public List findByG_F( long groupId, long[] folderIds, int start, int end, OrderByComparator orderByComparator, boolean useFinderCache) { if (folderIds == null) { folderIds = new long[0]; } else if (folderIds.length > 1) { folderIds = ArrayUtil.sortedUnique(folderIds); } if (folderIds.length == 1) { return findByG_F( groupId, folderIds[0], start, end, orderByComparator); } try (SafeCloseable safeCloseable = ctPersistenceHelper.setCTCollectionIdWithSafeCloseable( BookmarksEntry.class)) { Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { if (useFinderCache) { finderArgs = new Object[] { groupId, StringUtil.merge(folderIds) }; } } else if (useFinderCache) { finderArgs = new Object[] { groupId, StringUtil.merge(folderIds), start, end, orderByComparator }; } List list = null; if (useFinderCache) { list = (List)finderCache.getResult( _finderPathWithPaginationFindByG_F, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (BookmarksEntry bookmarksEntry : list) { if ((groupId != bookmarksEntry.getGroupId()) || !ArrayUtil.contains( folderIds, bookmarksEntry.getFolderId())) { list = null; break; } } } } if (list == null) { StringBundler sb = new StringBundler(); sb.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_G_F_GROUPID_2); if (folderIds.length > 0) { sb.append("("); sb.append(_FINDER_COLUMN_G_F_FOLDERID_7); sb.append(StringUtil.merge(folderIds)); sb.append(")"); sb.append(")"); } sb.setStringAt( removeConjunction(sb.stringAt(sb.index() - 1)), sb.index() - 1); if (orderByComparator != null) { appendOrderByComparator( sb, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_JPQL); } String sql = sb.toString(); Session session = null; try { session = openSession(); Query query = session.createQuery(sql); QueryPos queryPos = QueryPos.getInstance(query); queryPos.add(groupId); list = (List)QueryUtil.list( query, getDialect(), start, end); cacheResult(list); if (useFinderCache) { finderCache.putResult( _finderPathWithPaginationFindByG_F, finderArgs, list); } } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } return list; } } /** * Removes all the bookmarks entries where groupId = ? and folderId = ? from the database. * * @param groupId the group ID * @param folderId the folder ID */ @Override public void removeByG_F(long groupId, long folderId) { for (BookmarksEntry bookmarksEntry : findByG_F( groupId, folderId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(bookmarksEntry); } } /** * Returns the number of bookmarks entries where groupId = ? and folderId = ?. * * @param groupId the group ID * @param folderId the folder ID * @return the number of matching bookmarks entries */ @Override public int countByG_F(long groupId, long folderId) { try (SafeCloseable safeCloseable = ctPersistenceHelper.setCTCollectionIdWithSafeCloseable( BookmarksEntry.class)) { FinderPath finderPath = _finderPathCountByG_F; Object[] finderArgs = new Object[] {groupId, folderId}; Long count = (Long)finderCache.getResult( finderPath, finderArgs, this); if (count == null) { StringBundler sb = new StringBundler(3); sb.append(_SQL_COUNT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_G_F_GROUPID_2); sb.append(_FINDER_COLUMN_G_F_FOLDERID_2); String sql = sb.toString(); Session session = null; try { session = openSession(); Query query = session.createQuery(sql); QueryPos queryPos = QueryPos.getInstance(query); queryPos.add(groupId); queryPos.add(folderId); count = (Long)query.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } return count.intValue(); } } /** * Returns the number of bookmarks entries where groupId = ? and folderId = any ?. * * @param groupId the group ID * @param folderIds the folder IDs * @return the number of matching bookmarks entries */ @Override public int countByG_F(long groupId, long[] folderIds) { if (folderIds == null) { folderIds = new long[0]; } else if (folderIds.length > 1) { folderIds = ArrayUtil.sortedUnique(folderIds); } try (SafeCloseable safeCloseable = ctPersistenceHelper.setCTCollectionIdWithSafeCloseable( BookmarksEntry.class)) { Object[] finderArgs = new Object[] { groupId, StringUtil.merge(folderIds) }; Long count = (Long)finderCache.getResult( _finderPathWithPaginationCountByG_F, finderArgs, this); if (count == null) { StringBundler sb = new StringBundler(); sb.append(_SQL_COUNT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_G_F_GROUPID_2); if (folderIds.length > 0) { sb.append("("); sb.append(_FINDER_COLUMN_G_F_FOLDERID_7); sb.append(StringUtil.merge(folderIds)); sb.append(")"); sb.append(")"); } sb.setStringAt( removeConjunction(sb.stringAt(sb.index() - 1)), sb.index() - 1); String sql = sb.toString(); Session session = null; try { session = openSession(); Query query = session.createQuery(sql); QueryPos queryPos = QueryPos.getInstance(query); queryPos.add(groupId); count = (Long)query.uniqueResult(); finderCache.putResult( _finderPathWithPaginationCountByG_F, finderArgs, count); } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } return count.intValue(); } } /** * Returns the number of bookmarks entries that the user has permission to view where groupId = ? and folderId = ?. * * @param groupId the group ID * @param folderId the folder ID * @return the number of matching bookmarks entries that the user has permission to view */ @Override public int filterCountByG_F(long groupId, long folderId) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return countByG_F(groupId, folderId); } StringBundler sb = new StringBundler(3); sb.append(_FILTER_SQL_COUNT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_G_F_GROUPID_2); sb.append(_FINDER_COLUMN_G_F_FOLDERID_2); String sql = InlineSQLHelperUtil.replacePermissionCheck( sb.toString(), BookmarksEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery sqlQuery = session.createSynchronizedSQLQuery(sql); sqlQuery.addScalar( COUNT_COLUMN_NAME, com.liferay.portal.kernel.dao.orm.Type.LONG); QueryPos queryPos = QueryPos.getInstance(sqlQuery); queryPos.add(groupId); queryPos.add(folderId); Long count = (Long)sqlQuery.uniqueResult(); return count.intValue(); } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } /** * Returns the number of bookmarks entries that the user has permission to view where groupId = ? and folderId = any ?. * * @param groupId the group ID * @param folderIds the folder IDs * @return the number of matching bookmarks entries that the user has permission to view */ @Override public int filterCountByG_F(long groupId, long[] folderIds) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return countByG_F(groupId, folderIds); } if (folderIds == null) { folderIds = new long[0]; } else if (folderIds.length > 1) { folderIds = ArrayUtil.sortedUnique(folderIds); } StringBundler sb = new StringBundler(); sb.append(_FILTER_SQL_COUNT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_G_F_GROUPID_2); if (folderIds.length > 0) { sb.append("("); sb.append(_FINDER_COLUMN_G_F_FOLDERID_7); sb.append(StringUtil.merge(folderIds)); sb.append(")"); sb.append(")"); } sb.setStringAt( removeConjunction(sb.stringAt(sb.index() - 1)), sb.index() - 1); String sql = InlineSQLHelperUtil.replacePermissionCheck( sb.toString(), BookmarksEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery sqlQuery = session.createSynchronizedSQLQuery(sql); sqlQuery.addScalar( COUNT_COLUMN_NAME, com.liferay.portal.kernel.dao.orm.Type.LONG); QueryPos queryPos = QueryPos.getInstance(sqlQuery); queryPos.add(groupId); Long count = (Long)sqlQuery.uniqueResult(); return count.intValue(); } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } private static final String _FINDER_COLUMN_G_F_GROUPID_2 = "bookmarksEntry.groupId = ? AND "; private static final String _FINDER_COLUMN_G_F_FOLDERID_2 = "bookmarksEntry.folderId = ?"; private static final String _FINDER_COLUMN_G_F_FOLDERID_7 = "bookmarksEntry.folderId IN ("; private FinderPath _finderPathWithPaginationFindByG_S; private FinderPath _finderPathWithoutPaginationFindByG_S; private FinderPath _finderPathCountByG_S; /** * Returns all the bookmarks entries where groupId = ? and status = ?. * * @param groupId the group ID * @param status the status * @return the matching bookmarks entries */ @Override public List findByG_S(long groupId, int status) { return findByG_S( groupId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the bookmarks entries where groupId = ? and status = ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @return the range of matching bookmarks entries */ @Override public List findByG_S( long groupId, int status, int start, int end) { return findByG_S(groupId, status, start, end, null); } /** * Returns an ordered range of all the bookmarks entries where groupId = ? and status = ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching bookmarks entries */ @Override public List findByG_S( long groupId, int status, int start, int end, OrderByComparator orderByComparator) { return findByG_S(groupId, status, start, end, orderByComparator, true); } /** * Returns an ordered range of all the bookmarks entries where groupId = ? and status = ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @param useFinderCache whether to use the finder cache * @return the ordered range of matching bookmarks entries */ @Override public List findByG_S( long groupId, int status, int start, int end, OrderByComparator orderByComparator, boolean useFinderCache) { try (SafeCloseable safeCloseable = ctPersistenceHelper.setCTCollectionIdWithSafeCloseable( BookmarksEntry.class)) { FinderPath finderPath = null; Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { if (useFinderCache) { finderPath = _finderPathWithoutPaginationFindByG_S; finderArgs = new Object[] {groupId, status}; } } else if (useFinderCache) { finderPath = _finderPathWithPaginationFindByG_S; finderArgs = new Object[] { groupId, status, start, end, orderByComparator }; } List list = null; if (useFinderCache) { list = (List)finderCache.getResult( finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (BookmarksEntry bookmarksEntry : list) { if ((groupId != bookmarksEntry.getGroupId()) || (status != bookmarksEntry.getStatus())) { list = null; break; } } } } if (list == null) { StringBundler sb = null; if (orderByComparator != null) { sb = new StringBundler( 4 + (orderByComparator.getOrderByFields().length * 2)); } else { sb = new StringBundler(4); } sb.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_G_S_GROUPID_2); sb.append(_FINDER_COLUMN_G_S_STATUS_2); if (orderByComparator != null) { appendOrderByComparator( sb, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_JPQL); } String sql = sb.toString(); Session session = null; try { session = openSession(); Query query = session.createQuery(sql); QueryPos queryPos = QueryPos.getInstance(query); queryPos.add(groupId); queryPos.add(status); list = (List)QueryUtil.list( query, getDialect(), start, end); cacheResult(list); if (useFinderCache) { finderCache.putResult(finderPath, finderArgs, list); } } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } return list; } } /** * Returns the first bookmarks entry in the ordered set where groupId = ? and status = ?. * * @param groupId the group ID * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching bookmarks entry * @throws NoSuchEntryException if a matching bookmarks entry could not be found */ @Override public BookmarksEntry findByG_S_First( long groupId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BookmarksEntry bookmarksEntry = fetchByG_S_First( groupId, status, orderByComparator); if (bookmarksEntry != null) { return bookmarksEntry; } StringBundler sb = new StringBundler(6); sb.append(_NO_SUCH_ENTITY_WITH_KEY); sb.append("groupId="); sb.append(groupId); sb.append(", status="); sb.append(status); sb.append("}"); throw new NoSuchEntryException(sb.toString()); } /** * Returns the first bookmarks entry in the ordered set where groupId = ? and status = ?. * * @param groupId the group ID * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching bookmarks entry, or null if a matching bookmarks entry could not be found */ @Override public BookmarksEntry fetchByG_S_First( long groupId, int status, OrderByComparator orderByComparator) { List list = findByG_S( groupId, status, 0, 1, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the last bookmarks entry in the ordered set where groupId = ? and status = ?. * * @param groupId the group ID * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching bookmarks entry * @throws NoSuchEntryException if a matching bookmarks entry could not be found */ @Override public BookmarksEntry findByG_S_Last( long groupId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BookmarksEntry bookmarksEntry = fetchByG_S_Last( groupId, status, orderByComparator); if (bookmarksEntry != null) { return bookmarksEntry; } StringBundler sb = new StringBundler(6); sb.append(_NO_SUCH_ENTITY_WITH_KEY); sb.append("groupId="); sb.append(groupId); sb.append(", status="); sb.append(status); sb.append("}"); throw new NoSuchEntryException(sb.toString()); } /** * Returns the last bookmarks entry in the ordered set where groupId = ? and status = ?. * * @param groupId the group ID * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching bookmarks entry, or null if a matching bookmarks entry could not be found */ @Override public BookmarksEntry fetchByG_S_Last( long groupId, int status, OrderByComparator orderByComparator) { int count = countByG_S(groupId, status); if (count == 0) { return null; } List list = findByG_S( groupId, status, count - 1, count, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the bookmarks entries before and after the current bookmarks entry in the ordered set where groupId = ? and status = ?. * * @param entryId the primary key of the current bookmarks entry * @param groupId the group ID * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the previous, current, and next bookmarks entry * @throws NoSuchEntryException if a bookmarks entry with the primary key could not be found */ @Override public BookmarksEntry[] findByG_S_PrevAndNext( long entryId, long groupId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BookmarksEntry bookmarksEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BookmarksEntry[] array = new BookmarksEntryImpl[3]; array[0] = getByG_S_PrevAndNext( session, bookmarksEntry, groupId, status, orderByComparator, true); array[1] = bookmarksEntry; array[2] = getByG_S_PrevAndNext( session, bookmarksEntry, groupId, status, orderByComparator, false); return array; } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } protected BookmarksEntry getByG_S_PrevAndNext( Session session, BookmarksEntry bookmarksEntry, long groupId, int status, OrderByComparator orderByComparator, boolean previous) { StringBundler sb = null; if (orderByComparator != null) { sb = new StringBundler( 5 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { sb = new StringBundler(4); } sb.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_G_S_GROUPID_2); sb.append(_FINDER_COLUMN_G_S_STATUS_2); if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { sb.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { sb.append(_ORDER_BY_ENTITY_ALIAS); sb.append(orderByConditionFields[i]); if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { sb.append(WHERE_GREATER_THAN_HAS_NEXT); } else { sb.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { sb.append(WHERE_GREATER_THAN); } else { sb.append(WHERE_LESSER_THAN); } } } sb.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { sb.append(_ORDER_BY_ENTITY_ALIAS); sb.append(orderByFields[i]); if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { sb.append(ORDER_BY_ASC_HAS_NEXT); } else { sb.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { sb.append(ORDER_BY_ASC); } else { sb.append(ORDER_BY_DESC); } } } } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_JPQL); } String sql = sb.toString(); Query query = session.createQuery(sql); query.setFirstResult(0); query.setMaxResults(2); QueryPos queryPos = QueryPos.getInstance(query); queryPos.add(groupId); queryPos.add(status); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues( bookmarksEntry)) { queryPos.add(orderByConditionValue); } } List list = query.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Returns all the bookmarks entries that the user has permission to view where groupId = ? and status = ?. * * @param groupId the group ID * @param status the status * @return the matching bookmarks entries that the user has permission to view */ @Override public List filterFindByG_S(long groupId, int status) { return filterFindByG_S( groupId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the bookmarks entries that the user has permission to view where groupId = ? and status = ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @return the range of matching bookmarks entries that the user has permission to view */ @Override public List filterFindByG_S( long groupId, int status, int start, int end) { return filterFindByG_S(groupId, status, start, end, null); } /** * Returns an ordered range of all the bookmarks entries that the user has permissions to view where groupId = ? and status = ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching bookmarks entries that the user has permission to view */ @Override public List filterFindByG_S( long groupId, int status, int start, int end, OrderByComparator orderByComparator) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByG_S(groupId, status, start, end, orderByComparator); } StringBundler sb = null; if (orderByComparator != null) { sb = new StringBundler( 4 + (orderByComparator.getOrderByFields().length * 2)); } else { sb = new StringBundler(5); } if (getDB().isSupportsInlineDistinct()) { sb.append(_FILTER_SQL_SELECT_BOOKMARKSENTRY_WHERE); } else { sb.append( _FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_1); } sb.append(_FINDER_COLUMN_G_S_GROUPID_2); sb.append(_FINDER_COLUMN_G_S_STATUS_2); if (!getDB().isSupportsInlineDistinct()) { sb.append( _FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { if (getDB().isSupportsInlineDistinct()) { appendOrderByComparator( sb, _ORDER_BY_ENTITY_ALIAS, orderByComparator, true); } else { appendOrderByComparator( sb, _ORDER_BY_ENTITY_TABLE, orderByComparator, true); } } else { if (getDB().isSupportsInlineDistinct()) { sb.append(BookmarksEntryModelImpl.ORDER_BY_SQL_INLINE_DISTINCT); } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck( sb.toString(), BookmarksEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery sqlQuery = session.createSynchronizedSQLQuery(sql); if (getDB().isSupportsInlineDistinct()) { sqlQuery.addEntity( _FILTER_ENTITY_ALIAS, BookmarksEntryImpl.class); } else { sqlQuery.addEntity( _FILTER_ENTITY_TABLE, BookmarksEntryImpl.class); } QueryPos queryPos = QueryPos.getInstance(sqlQuery); queryPos.add(groupId); queryPos.add(status); return (List)QueryUtil.list( sqlQuery, getDialect(), start, end); } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } /** * Returns the bookmarks entries before and after the current bookmarks entry in the ordered set of bookmarks entries that the user has permission to view where groupId = ? and status = ?. * * @param entryId the primary key of the current bookmarks entry * @param groupId the group ID * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the previous, current, and next bookmarks entry * @throws NoSuchEntryException if a bookmarks entry with the primary key could not be found */ @Override public BookmarksEntry[] filterFindByG_S_PrevAndNext( long entryId, long groupId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByG_S_PrevAndNext( entryId, groupId, status, orderByComparator); } BookmarksEntry bookmarksEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BookmarksEntry[] array = new BookmarksEntryImpl[3]; array[0] = filterGetByG_S_PrevAndNext( session, bookmarksEntry, groupId, status, orderByComparator, true); array[1] = bookmarksEntry; array[2] = filterGetByG_S_PrevAndNext( session, bookmarksEntry, groupId, status, orderByComparator, false); return array; } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } protected BookmarksEntry filterGetByG_S_PrevAndNext( Session session, BookmarksEntry bookmarksEntry, long groupId, int status, OrderByComparator orderByComparator, boolean previous) { StringBundler sb = null; if (orderByComparator != null) { sb = new StringBundler( 6 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { sb = new StringBundler(5); } if (getDB().isSupportsInlineDistinct()) { sb.append(_FILTER_SQL_SELECT_BOOKMARKSENTRY_WHERE); } else { sb.append( _FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_1); } sb.append(_FINDER_COLUMN_G_S_GROUPID_2); sb.append(_FINDER_COLUMN_G_S_STATUS_2); if (!getDB().isSupportsInlineDistinct()) { sb.append( _FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { sb.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { if (getDB().isSupportsInlineDistinct()) { sb.append( getColumnName( _ORDER_BY_ENTITY_ALIAS, orderByConditionFields[i], true)); } else { sb.append( getColumnName( _ORDER_BY_ENTITY_TABLE, orderByConditionFields[i], true)); } if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { sb.append(WHERE_GREATER_THAN_HAS_NEXT); } else { sb.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { sb.append(WHERE_GREATER_THAN); } else { sb.append(WHERE_LESSER_THAN); } } } sb.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { if (getDB().isSupportsInlineDistinct()) { sb.append( getColumnName( _ORDER_BY_ENTITY_ALIAS, orderByFields[i], true)); } else { sb.append( getColumnName( _ORDER_BY_ENTITY_TABLE, orderByFields[i], true)); } if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { sb.append(ORDER_BY_ASC_HAS_NEXT); } else { sb.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { sb.append(ORDER_BY_ASC); } else { sb.append(ORDER_BY_DESC); } } } } else { if (getDB().isSupportsInlineDistinct()) { sb.append(BookmarksEntryModelImpl.ORDER_BY_SQL_INLINE_DISTINCT); } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck( sb.toString(), BookmarksEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); SQLQuery sqlQuery = session.createSynchronizedSQLQuery(sql); sqlQuery.setFirstResult(0); sqlQuery.setMaxResults(2); if (getDB().isSupportsInlineDistinct()) { sqlQuery.addEntity(_FILTER_ENTITY_ALIAS, BookmarksEntryImpl.class); } else { sqlQuery.addEntity(_FILTER_ENTITY_TABLE, BookmarksEntryImpl.class); } QueryPos queryPos = QueryPos.getInstance(sqlQuery); queryPos.add(groupId); queryPos.add(status); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues( bookmarksEntry)) { queryPos.add(orderByConditionValue); } } List list = sqlQuery.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Removes all the bookmarks entries where groupId = ? and status = ? from the database. * * @param groupId the group ID * @param status the status */ @Override public void removeByG_S(long groupId, int status) { for (BookmarksEntry bookmarksEntry : findByG_S( groupId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(bookmarksEntry); } } /** * Returns the number of bookmarks entries where groupId = ? and status = ?. * * @param groupId the group ID * @param status the status * @return the number of matching bookmarks entries */ @Override public int countByG_S(long groupId, int status) { try (SafeCloseable safeCloseable = ctPersistenceHelper.setCTCollectionIdWithSafeCloseable( BookmarksEntry.class)) { FinderPath finderPath = _finderPathCountByG_S; Object[] finderArgs = new Object[] {groupId, status}; Long count = (Long)finderCache.getResult( finderPath, finderArgs, this); if (count == null) { StringBundler sb = new StringBundler(3); sb.append(_SQL_COUNT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_G_S_GROUPID_2); sb.append(_FINDER_COLUMN_G_S_STATUS_2); String sql = sb.toString(); Session session = null; try { session = openSession(); Query query = session.createQuery(sql); QueryPos queryPos = QueryPos.getInstance(query); queryPos.add(groupId); queryPos.add(status); count = (Long)query.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } return count.intValue(); } } /** * Returns the number of bookmarks entries that the user has permission to view where groupId = ? and status = ?. * * @param groupId the group ID * @param status the status * @return the number of matching bookmarks entries that the user has permission to view */ @Override public int filterCountByG_S(long groupId, int status) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return countByG_S(groupId, status); } StringBundler sb = new StringBundler(3); sb.append(_FILTER_SQL_COUNT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_G_S_GROUPID_2); sb.append(_FINDER_COLUMN_G_S_STATUS_2); String sql = InlineSQLHelperUtil.replacePermissionCheck( sb.toString(), BookmarksEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery sqlQuery = session.createSynchronizedSQLQuery(sql); sqlQuery.addScalar( COUNT_COLUMN_NAME, com.liferay.portal.kernel.dao.orm.Type.LONG); QueryPos queryPos = QueryPos.getInstance(sqlQuery); queryPos.add(groupId); queryPos.add(status); Long count = (Long)sqlQuery.uniqueResult(); return count.intValue(); } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } private static final String _FINDER_COLUMN_G_S_GROUPID_2 = "bookmarksEntry.groupId = ? AND "; private static final String _FINDER_COLUMN_G_S_STATUS_2 = "bookmarksEntry.status = ?"; private FinderPath _finderPathWithPaginationFindByG_NotS; private FinderPath _finderPathWithPaginationCountByG_NotS; /** * Returns all the bookmarks entries where groupId = ? and status ≠ ?. * * @param groupId the group ID * @param status the status * @return the matching bookmarks entries */ @Override public List findByG_NotS(long groupId, int status) { return findByG_NotS( groupId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the bookmarks entries where groupId = ? and status ≠ ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @return the range of matching bookmarks entries */ @Override public List findByG_NotS( long groupId, int status, int start, int end) { return findByG_NotS(groupId, status, start, end, null); } /** * Returns an ordered range of all the bookmarks entries where groupId = ? and status ≠ ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching bookmarks entries */ @Override public List findByG_NotS( long groupId, int status, int start, int end, OrderByComparator orderByComparator) { return findByG_NotS( groupId, status, start, end, orderByComparator, true); } /** * Returns an ordered range of all the bookmarks entries where groupId = ? and status ≠ ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @param useFinderCache whether to use the finder cache * @return the ordered range of matching bookmarks entries */ @Override public List findByG_NotS( long groupId, int status, int start, int end, OrderByComparator orderByComparator, boolean useFinderCache) { try (SafeCloseable safeCloseable = ctPersistenceHelper.setCTCollectionIdWithSafeCloseable( BookmarksEntry.class)) { FinderPath finderPath = null; Object[] finderArgs = null; finderPath = _finderPathWithPaginationFindByG_NotS; finderArgs = new Object[] { groupId, status, start, end, orderByComparator }; List list = null; if (useFinderCache) { list = (List)finderCache.getResult( finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (BookmarksEntry bookmarksEntry : list) { if ((groupId != bookmarksEntry.getGroupId()) || (status == bookmarksEntry.getStatus())) { list = null; break; } } } } if (list == null) { StringBundler sb = null; if (orderByComparator != null) { sb = new StringBundler( 4 + (orderByComparator.getOrderByFields().length * 2)); } else { sb = new StringBundler(4); } sb.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_G_NOTS_GROUPID_2); sb.append(_FINDER_COLUMN_G_NOTS_STATUS_2); if (orderByComparator != null) { appendOrderByComparator( sb, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_JPQL); } String sql = sb.toString(); Session session = null; try { session = openSession(); Query query = session.createQuery(sql); QueryPos queryPos = QueryPos.getInstance(query); queryPos.add(groupId); queryPos.add(status); list = (List)QueryUtil.list( query, getDialect(), start, end); cacheResult(list); if (useFinderCache) { finderCache.putResult(finderPath, finderArgs, list); } } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } return list; } } /** * Returns the first bookmarks entry in the ordered set where groupId = ? and status ≠ ?. * * @param groupId the group ID * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching bookmarks entry * @throws NoSuchEntryException if a matching bookmarks entry could not be found */ @Override public BookmarksEntry findByG_NotS_First( long groupId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BookmarksEntry bookmarksEntry = fetchByG_NotS_First( groupId, status, orderByComparator); if (bookmarksEntry != null) { return bookmarksEntry; } StringBundler sb = new StringBundler(6); sb.append(_NO_SUCH_ENTITY_WITH_KEY); sb.append("groupId="); sb.append(groupId); sb.append(", status!="); sb.append(status); sb.append("}"); throw new NoSuchEntryException(sb.toString()); } /** * Returns the first bookmarks entry in the ordered set where groupId = ? and status ≠ ?. * * @param groupId the group ID * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching bookmarks entry, or null if a matching bookmarks entry could not be found */ @Override public BookmarksEntry fetchByG_NotS_First( long groupId, int status, OrderByComparator orderByComparator) { List list = findByG_NotS( groupId, status, 0, 1, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the last bookmarks entry in the ordered set where groupId = ? and status ≠ ?. * * @param groupId the group ID * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching bookmarks entry * @throws NoSuchEntryException if a matching bookmarks entry could not be found */ @Override public BookmarksEntry findByG_NotS_Last( long groupId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BookmarksEntry bookmarksEntry = fetchByG_NotS_Last( groupId, status, orderByComparator); if (bookmarksEntry != null) { return bookmarksEntry; } StringBundler sb = new StringBundler(6); sb.append(_NO_SUCH_ENTITY_WITH_KEY); sb.append("groupId="); sb.append(groupId); sb.append(", status!="); sb.append(status); sb.append("}"); throw new NoSuchEntryException(sb.toString()); } /** * Returns the last bookmarks entry in the ordered set where groupId = ? and status ≠ ?. * * @param groupId the group ID * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching bookmarks entry, or null if a matching bookmarks entry could not be found */ @Override public BookmarksEntry fetchByG_NotS_Last( long groupId, int status, OrderByComparator orderByComparator) { int count = countByG_NotS(groupId, status); if (count == 0) { return null; } List list = findByG_NotS( groupId, status, count - 1, count, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the bookmarks entries before and after the current bookmarks entry in the ordered set where groupId = ? and status ≠ ?. * * @param entryId the primary key of the current bookmarks entry * @param groupId the group ID * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the previous, current, and next bookmarks entry * @throws NoSuchEntryException if a bookmarks entry with the primary key could not be found */ @Override public BookmarksEntry[] findByG_NotS_PrevAndNext( long entryId, long groupId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BookmarksEntry bookmarksEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BookmarksEntry[] array = new BookmarksEntryImpl[3]; array[0] = getByG_NotS_PrevAndNext( session, bookmarksEntry, groupId, status, orderByComparator, true); array[1] = bookmarksEntry; array[2] = getByG_NotS_PrevAndNext( session, bookmarksEntry, groupId, status, orderByComparator, false); return array; } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } protected BookmarksEntry getByG_NotS_PrevAndNext( Session session, BookmarksEntry bookmarksEntry, long groupId, int status, OrderByComparator orderByComparator, boolean previous) { StringBundler sb = null; if (orderByComparator != null) { sb = new StringBundler( 5 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { sb = new StringBundler(4); } sb.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_G_NOTS_GROUPID_2); sb.append(_FINDER_COLUMN_G_NOTS_STATUS_2); if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { sb.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { sb.append(_ORDER_BY_ENTITY_ALIAS); sb.append(orderByConditionFields[i]); if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { sb.append(WHERE_GREATER_THAN_HAS_NEXT); } else { sb.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { sb.append(WHERE_GREATER_THAN); } else { sb.append(WHERE_LESSER_THAN); } } } sb.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { sb.append(_ORDER_BY_ENTITY_ALIAS); sb.append(orderByFields[i]); if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { sb.append(ORDER_BY_ASC_HAS_NEXT); } else { sb.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { sb.append(ORDER_BY_ASC); } else { sb.append(ORDER_BY_DESC); } } } } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_JPQL); } String sql = sb.toString(); Query query = session.createQuery(sql); query.setFirstResult(0); query.setMaxResults(2); QueryPos queryPos = QueryPos.getInstance(query); queryPos.add(groupId); queryPos.add(status); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues( bookmarksEntry)) { queryPos.add(orderByConditionValue); } } List list = query.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Returns all the bookmarks entries that the user has permission to view where groupId = ? and status ≠ ?. * * @param groupId the group ID * @param status the status * @return the matching bookmarks entries that the user has permission to view */ @Override public List filterFindByG_NotS(long groupId, int status) { return filterFindByG_NotS( groupId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the bookmarks entries that the user has permission to view where groupId = ? and status ≠ ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @return the range of matching bookmarks entries that the user has permission to view */ @Override public List filterFindByG_NotS( long groupId, int status, int start, int end) { return filterFindByG_NotS(groupId, status, start, end, null); } /** * Returns an ordered range of all the bookmarks entries that the user has permissions to view where groupId = ? and status ≠ ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching bookmarks entries that the user has permission to view */ @Override public List filterFindByG_NotS( long groupId, int status, int start, int end, OrderByComparator orderByComparator) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByG_NotS(groupId, status, start, end, orderByComparator); } StringBundler sb = null; if (orderByComparator != null) { sb = new StringBundler( 4 + (orderByComparator.getOrderByFields().length * 2)); } else { sb = new StringBundler(5); } if (getDB().isSupportsInlineDistinct()) { sb.append(_FILTER_SQL_SELECT_BOOKMARKSENTRY_WHERE); } else { sb.append( _FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_1); } sb.append(_FINDER_COLUMN_G_NOTS_GROUPID_2); sb.append(_FINDER_COLUMN_G_NOTS_STATUS_2); if (!getDB().isSupportsInlineDistinct()) { sb.append( _FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { if (getDB().isSupportsInlineDistinct()) { appendOrderByComparator( sb, _ORDER_BY_ENTITY_ALIAS, orderByComparator, true); } else { appendOrderByComparator( sb, _ORDER_BY_ENTITY_TABLE, orderByComparator, true); } } else { if (getDB().isSupportsInlineDistinct()) { sb.append(BookmarksEntryModelImpl.ORDER_BY_SQL_INLINE_DISTINCT); } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck( sb.toString(), BookmarksEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery sqlQuery = session.createSynchronizedSQLQuery(sql); if (getDB().isSupportsInlineDistinct()) { sqlQuery.addEntity( _FILTER_ENTITY_ALIAS, BookmarksEntryImpl.class); } else { sqlQuery.addEntity( _FILTER_ENTITY_TABLE, BookmarksEntryImpl.class); } QueryPos queryPos = QueryPos.getInstance(sqlQuery); queryPos.add(groupId); queryPos.add(status); return (List)QueryUtil.list( sqlQuery, getDialect(), start, end); } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } /** * Returns the bookmarks entries before and after the current bookmarks entry in the ordered set of bookmarks entries that the user has permission to view where groupId = ? and status ≠ ?. * * @param entryId the primary key of the current bookmarks entry * @param groupId the group ID * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the previous, current, and next bookmarks entry * @throws NoSuchEntryException if a bookmarks entry with the primary key could not be found */ @Override public BookmarksEntry[] filterFindByG_NotS_PrevAndNext( long entryId, long groupId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByG_NotS_PrevAndNext( entryId, groupId, status, orderByComparator); } BookmarksEntry bookmarksEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BookmarksEntry[] array = new BookmarksEntryImpl[3]; array[0] = filterGetByG_NotS_PrevAndNext( session, bookmarksEntry, groupId, status, orderByComparator, true); array[1] = bookmarksEntry; array[2] = filterGetByG_NotS_PrevAndNext( session, bookmarksEntry, groupId, status, orderByComparator, false); return array; } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } protected BookmarksEntry filterGetByG_NotS_PrevAndNext( Session session, BookmarksEntry bookmarksEntry, long groupId, int status, OrderByComparator orderByComparator, boolean previous) { StringBundler sb = null; if (orderByComparator != null) { sb = new StringBundler( 6 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { sb = new StringBundler(5); } if (getDB().isSupportsInlineDistinct()) { sb.append(_FILTER_SQL_SELECT_BOOKMARKSENTRY_WHERE); } else { sb.append( _FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_1); } sb.append(_FINDER_COLUMN_G_NOTS_GROUPID_2); sb.append(_FINDER_COLUMN_G_NOTS_STATUS_2); if (!getDB().isSupportsInlineDistinct()) { sb.append( _FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { sb.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { if (getDB().isSupportsInlineDistinct()) { sb.append( getColumnName( _ORDER_BY_ENTITY_ALIAS, orderByConditionFields[i], true)); } else { sb.append( getColumnName( _ORDER_BY_ENTITY_TABLE, orderByConditionFields[i], true)); } if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { sb.append(WHERE_GREATER_THAN_HAS_NEXT); } else { sb.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { sb.append(WHERE_GREATER_THAN); } else { sb.append(WHERE_LESSER_THAN); } } } sb.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { if (getDB().isSupportsInlineDistinct()) { sb.append( getColumnName( _ORDER_BY_ENTITY_ALIAS, orderByFields[i], true)); } else { sb.append( getColumnName( _ORDER_BY_ENTITY_TABLE, orderByFields[i], true)); } if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { sb.append(ORDER_BY_ASC_HAS_NEXT); } else { sb.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { sb.append(ORDER_BY_ASC); } else { sb.append(ORDER_BY_DESC); } } } } else { if (getDB().isSupportsInlineDistinct()) { sb.append(BookmarksEntryModelImpl.ORDER_BY_SQL_INLINE_DISTINCT); } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck( sb.toString(), BookmarksEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); SQLQuery sqlQuery = session.createSynchronizedSQLQuery(sql); sqlQuery.setFirstResult(0); sqlQuery.setMaxResults(2); if (getDB().isSupportsInlineDistinct()) { sqlQuery.addEntity(_FILTER_ENTITY_ALIAS, BookmarksEntryImpl.class); } else { sqlQuery.addEntity(_FILTER_ENTITY_TABLE, BookmarksEntryImpl.class); } QueryPos queryPos = QueryPos.getInstance(sqlQuery); queryPos.add(groupId); queryPos.add(status); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues( bookmarksEntry)) { queryPos.add(orderByConditionValue); } } List list = sqlQuery.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Removes all the bookmarks entries where groupId = ? and status ≠ ? from the database. * * @param groupId the group ID * @param status the status */ @Override public void removeByG_NotS(long groupId, int status) { for (BookmarksEntry bookmarksEntry : findByG_NotS( groupId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(bookmarksEntry); } } /** * Returns the number of bookmarks entries where groupId = ? and status ≠ ?. * * @param groupId the group ID * @param status the status * @return the number of matching bookmarks entries */ @Override public int countByG_NotS(long groupId, int status) { try (SafeCloseable safeCloseable = ctPersistenceHelper.setCTCollectionIdWithSafeCloseable( BookmarksEntry.class)) { FinderPath finderPath = _finderPathWithPaginationCountByG_NotS; Object[] finderArgs = new Object[] {groupId, status}; Long count = (Long)finderCache.getResult( finderPath, finderArgs, this); if (count == null) { StringBundler sb = new StringBundler(3); sb.append(_SQL_COUNT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_G_NOTS_GROUPID_2); sb.append(_FINDER_COLUMN_G_NOTS_STATUS_2); String sql = sb.toString(); Session session = null; try { session = openSession(); Query query = session.createQuery(sql); QueryPos queryPos = QueryPos.getInstance(query); queryPos.add(groupId); queryPos.add(status); count = (Long)query.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } return count.intValue(); } } /** * Returns the number of bookmarks entries that the user has permission to view where groupId = ? and status ≠ ?. * * @param groupId the group ID * @param status the status * @return the number of matching bookmarks entries that the user has permission to view */ @Override public int filterCountByG_NotS(long groupId, int status) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return countByG_NotS(groupId, status); } StringBundler sb = new StringBundler(3); sb.append(_FILTER_SQL_COUNT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_G_NOTS_GROUPID_2); sb.append(_FINDER_COLUMN_G_NOTS_STATUS_2); String sql = InlineSQLHelperUtil.replacePermissionCheck( sb.toString(), BookmarksEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery sqlQuery = session.createSynchronizedSQLQuery(sql); sqlQuery.addScalar( COUNT_COLUMN_NAME, com.liferay.portal.kernel.dao.orm.Type.LONG); QueryPos queryPos = QueryPos.getInstance(sqlQuery); queryPos.add(groupId); queryPos.add(status); Long count = (Long)sqlQuery.uniqueResult(); return count.intValue(); } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } private static final String _FINDER_COLUMN_G_NOTS_GROUPID_2 = "bookmarksEntry.groupId = ? AND "; private static final String _FINDER_COLUMN_G_NOTS_STATUS_2 = "bookmarksEntry.status != ?"; private FinderPath _finderPathWithPaginationFindByC_NotS; private FinderPath _finderPathWithPaginationCountByC_NotS; /** * Returns all the bookmarks entries where companyId = ? and status ≠ ?. * * @param companyId the company ID * @param status the status * @return the matching bookmarks entries */ @Override public List findByC_NotS(long companyId, int status) { return findByC_NotS( companyId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the bookmarks entries where companyId = ? and status ≠ ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param companyId the company ID * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @return the range of matching bookmarks entries */ @Override public List findByC_NotS( long companyId, int status, int start, int end) { return findByC_NotS(companyId, status, start, end, null); } /** * Returns an ordered range of all the bookmarks entries where companyId = ? and status ≠ ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param companyId the company ID * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching bookmarks entries */ @Override public List findByC_NotS( long companyId, int status, int start, int end, OrderByComparator orderByComparator) { return findByC_NotS( companyId, status, start, end, orderByComparator, true); } /** * Returns an ordered range of all the bookmarks entries where companyId = ? and status ≠ ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param companyId the company ID * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @param useFinderCache whether to use the finder cache * @return the ordered range of matching bookmarks entries */ @Override public List findByC_NotS( long companyId, int status, int start, int end, OrderByComparator orderByComparator, boolean useFinderCache) { try (SafeCloseable safeCloseable = ctPersistenceHelper.setCTCollectionIdWithSafeCloseable( BookmarksEntry.class)) { FinderPath finderPath = null; Object[] finderArgs = null; finderPath = _finderPathWithPaginationFindByC_NotS; finderArgs = new Object[] { companyId, status, start, end, orderByComparator }; List list = null; if (useFinderCache) { list = (List)finderCache.getResult( finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (BookmarksEntry bookmarksEntry : list) { if ((companyId != bookmarksEntry.getCompanyId()) || (status == bookmarksEntry.getStatus())) { list = null; break; } } } } if (list == null) { StringBundler sb = null; if (orderByComparator != null) { sb = new StringBundler( 4 + (orderByComparator.getOrderByFields().length * 2)); } else { sb = new StringBundler(4); } sb.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_C_NOTS_COMPANYID_2); sb.append(_FINDER_COLUMN_C_NOTS_STATUS_2); if (orderByComparator != null) { appendOrderByComparator( sb, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_JPQL); } String sql = sb.toString(); Session session = null; try { session = openSession(); Query query = session.createQuery(sql); QueryPos queryPos = QueryPos.getInstance(query); queryPos.add(companyId); queryPos.add(status); list = (List)QueryUtil.list( query, getDialect(), start, end); cacheResult(list); if (useFinderCache) { finderCache.putResult(finderPath, finderArgs, list); } } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } return list; } } /** * Returns the first bookmarks entry in the ordered set where companyId = ? and status ≠ ?. * * @param companyId the company ID * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching bookmarks entry * @throws NoSuchEntryException if a matching bookmarks entry could not be found */ @Override public BookmarksEntry findByC_NotS_First( long companyId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BookmarksEntry bookmarksEntry = fetchByC_NotS_First( companyId, status, orderByComparator); if (bookmarksEntry != null) { return bookmarksEntry; } StringBundler sb = new StringBundler(6); sb.append(_NO_SUCH_ENTITY_WITH_KEY); sb.append("companyId="); sb.append(companyId); sb.append(", status!="); sb.append(status); sb.append("}"); throw new NoSuchEntryException(sb.toString()); } /** * Returns the first bookmarks entry in the ordered set where companyId = ? and status ≠ ?. * * @param companyId the company ID * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching bookmarks entry, or null if a matching bookmarks entry could not be found */ @Override public BookmarksEntry fetchByC_NotS_First( long companyId, int status, OrderByComparator orderByComparator) { List list = findByC_NotS( companyId, status, 0, 1, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the last bookmarks entry in the ordered set where companyId = ? and status ≠ ?. * * @param companyId the company ID * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching bookmarks entry * @throws NoSuchEntryException if a matching bookmarks entry could not be found */ @Override public BookmarksEntry findByC_NotS_Last( long companyId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BookmarksEntry bookmarksEntry = fetchByC_NotS_Last( companyId, status, orderByComparator); if (bookmarksEntry != null) { return bookmarksEntry; } StringBundler sb = new StringBundler(6); sb.append(_NO_SUCH_ENTITY_WITH_KEY); sb.append("companyId="); sb.append(companyId); sb.append(", status!="); sb.append(status); sb.append("}"); throw new NoSuchEntryException(sb.toString()); } /** * Returns the last bookmarks entry in the ordered set where companyId = ? and status ≠ ?. * * @param companyId the company ID * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching bookmarks entry, or null if a matching bookmarks entry could not be found */ @Override public BookmarksEntry fetchByC_NotS_Last( long companyId, int status, OrderByComparator orderByComparator) { int count = countByC_NotS(companyId, status); if (count == 0) { return null; } List list = findByC_NotS( companyId, status, count - 1, count, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the bookmarks entries before and after the current bookmarks entry in the ordered set where companyId = ? and status ≠ ?. * * @param entryId the primary key of the current bookmarks entry * @param companyId the company ID * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the previous, current, and next bookmarks entry * @throws NoSuchEntryException if a bookmarks entry with the primary key could not be found */ @Override public BookmarksEntry[] findByC_NotS_PrevAndNext( long entryId, long companyId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BookmarksEntry bookmarksEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BookmarksEntry[] array = new BookmarksEntryImpl[3]; array[0] = getByC_NotS_PrevAndNext( session, bookmarksEntry, companyId, status, orderByComparator, true); array[1] = bookmarksEntry; array[2] = getByC_NotS_PrevAndNext( session, bookmarksEntry, companyId, status, orderByComparator, false); return array; } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } protected BookmarksEntry getByC_NotS_PrevAndNext( Session session, BookmarksEntry bookmarksEntry, long companyId, int status, OrderByComparator orderByComparator, boolean previous) { StringBundler sb = null; if (orderByComparator != null) { sb = new StringBundler( 5 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { sb = new StringBundler(4); } sb.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_C_NOTS_COMPANYID_2); sb.append(_FINDER_COLUMN_C_NOTS_STATUS_2); if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { sb.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { sb.append(_ORDER_BY_ENTITY_ALIAS); sb.append(orderByConditionFields[i]); if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { sb.append(WHERE_GREATER_THAN_HAS_NEXT); } else { sb.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { sb.append(WHERE_GREATER_THAN); } else { sb.append(WHERE_LESSER_THAN); } } } sb.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { sb.append(_ORDER_BY_ENTITY_ALIAS); sb.append(orderByFields[i]); if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { sb.append(ORDER_BY_ASC_HAS_NEXT); } else { sb.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { sb.append(ORDER_BY_ASC); } else { sb.append(ORDER_BY_DESC); } } } } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_JPQL); } String sql = sb.toString(); Query query = session.createQuery(sql); query.setFirstResult(0); query.setMaxResults(2); QueryPos queryPos = QueryPos.getInstance(query); queryPos.add(companyId); queryPos.add(status); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues( bookmarksEntry)) { queryPos.add(orderByConditionValue); } } List list = query.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Removes all the bookmarks entries where companyId = ? and status ≠ ? from the database. * * @param companyId the company ID * @param status the status */ @Override public void removeByC_NotS(long companyId, int status) { for (BookmarksEntry bookmarksEntry : findByC_NotS( companyId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(bookmarksEntry); } } /** * Returns the number of bookmarks entries where companyId = ? and status ≠ ?. * * @param companyId the company ID * @param status the status * @return the number of matching bookmarks entries */ @Override public int countByC_NotS(long companyId, int status) { try (SafeCloseable safeCloseable = ctPersistenceHelper.setCTCollectionIdWithSafeCloseable( BookmarksEntry.class)) { FinderPath finderPath = _finderPathWithPaginationCountByC_NotS; Object[] finderArgs = new Object[] {companyId, status}; Long count = (Long)finderCache.getResult( finderPath, finderArgs, this); if (count == null) { StringBundler sb = new StringBundler(3); sb.append(_SQL_COUNT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_C_NOTS_COMPANYID_2); sb.append(_FINDER_COLUMN_C_NOTS_STATUS_2); String sql = sb.toString(); Session session = null; try { session = openSession(); Query query = session.createQuery(sql); QueryPos queryPos = QueryPos.getInstance(query); queryPos.add(companyId); queryPos.add(status); count = (Long)query.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } return count.intValue(); } } private static final String _FINDER_COLUMN_C_NOTS_COMPANYID_2 = "bookmarksEntry.companyId = ? AND "; private static final String _FINDER_COLUMN_C_NOTS_STATUS_2 = "bookmarksEntry.status != ?"; private FinderPath _finderPathWithPaginationFindByG_U_S; private FinderPath _finderPathWithoutPaginationFindByG_U_S; private FinderPath _finderPathCountByG_U_S; /** * Returns all the bookmarks entries where groupId = ? and userId = ? and status = ?. * * @param groupId the group ID * @param userId the user ID * @param status the status * @return the matching bookmarks entries */ @Override public List findByG_U_S( long groupId, long userId, int status) { return findByG_U_S( groupId, userId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the bookmarks entries where groupId = ? and userId = ? and status = ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param userId the user ID * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @return the range of matching bookmarks entries */ @Override public List findByG_U_S( long groupId, long userId, int status, int start, int end) { return findByG_U_S(groupId, userId, status, start, end, null); } /** * Returns an ordered range of all the bookmarks entries where groupId = ? and userId = ? and status = ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param userId the user ID * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching bookmarks entries */ @Override public List findByG_U_S( long groupId, long userId, int status, int start, int end, OrderByComparator orderByComparator) { return findByG_U_S( groupId, userId, status, start, end, orderByComparator, true); } /** * Returns an ordered range of all the bookmarks entries where groupId = ? and userId = ? and status = ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param userId the user ID * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @param useFinderCache whether to use the finder cache * @return the ordered range of matching bookmarks entries */ @Override public List findByG_U_S( long groupId, long userId, int status, int start, int end, OrderByComparator orderByComparator, boolean useFinderCache) { try (SafeCloseable safeCloseable = ctPersistenceHelper.setCTCollectionIdWithSafeCloseable( BookmarksEntry.class)) { FinderPath finderPath = null; Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { if (useFinderCache) { finderPath = _finderPathWithoutPaginationFindByG_U_S; finderArgs = new Object[] {groupId, userId, status}; } } else if (useFinderCache) { finderPath = _finderPathWithPaginationFindByG_U_S; finderArgs = new Object[] { groupId, userId, status, start, end, orderByComparator }; } List list = null; if (useFinderCache) { list = (List)finderCache.getResult( finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (BookmarksEntry bookmarksEntry : list) { if ((groupId != bookmarksEntry.getGroupId()) || (userId != bookmarksEntry.getUserId()) || (status != bookmarksEntry.getStatus())) { list = null; break; } } } } if (list == null) { StringBundler sb = null; if (orderByComparator != null) { sb = new StringBundler( 5 + (orderByComparator.getOrderByFields().length * 2)); } else { sb = new StringBundler(5); } sb.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_G_U_S_GROUPID_2); sb.append(_FINDER_COLUMN_G_U_S_USERID_2); sb.append(_FINDER_COLUMN_G_U_S_STATUS_2); if (orderByComparator != null) { appendOrderByComparator( sb, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_JPQL); } String sql = sb.toString(); Session session = null; try { session = openSession(); Query query = session.createQuery(sql); QueryPos queryPos = QueryPos.getInstance(query); queryPos.add(groupId); queryPos.add(userId); queryPos.add(status); list = (List)QueryUtil.list( query, getDialect(), start, end); cacheResult(list); if (useFinderCache) { finderCache.putResult(finderPath, finderArgs, list); } } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } return list; } } /** * Returns the first bookmarks entry in the ordered set where groupId = ? and userId = ? and status = ?. * * @param groupId the group ID * @param userId the user ID * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching bookmarks entry * @throws NoSuchEntryException if a matching bookmarks entry could not be found */ @Override public BookmarksEntry findByG_U_S_First( long groupId, long userId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BookmarksEntry bookmarksEntry = fetchByG_U_S_First( groupId, userId, status, orderByComparator); if (bookmarksEntry != null) { return bookmarksEntry; } StringBundler sb = new StringBundler(8); sb.append(_NO_SUCH_ENTITY_WITH_KEY); sb.append("groupId="); sb.append(groupId); sb.append(", userId="); sb.append(userId); sb.append(", status="); sb.append(status); sb.append("}"); throw new NoSuchEntryException(sb.toString()); } /** * Returns the first bookmarks entry in the ordered set where groupId = ? and userId = ? and status = ?. * * @param groupId the group ID * @param userId the user ID * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching bookmarks entry, or null if a matching bookmarks entry could not be found */ @Override public BookmarksEntry fetchByG_U_S_First( long groupId, long userId, int status, OrderByComparator orderByComparator) { List list = findByG_U_S( groupId, userId, status, 0, 1, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the last bookmarks entry in the ordered set where groupId = ? and userId = ? and status = ?. * * @param groupId the group ID * @param userId the user ID * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching bookmarks entry * @throws NoSuchEntryException if a matching bookmarks entry could not be found */ @Override public BookmarksEntry findByG_U_S_Last( long groupId, long userId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BookmarksEntry bookmarksEntry = fetchByG_U_S_Last( groupId, userId, status, orderByComparator); if (bookmarksEntry != null) { return bookmarksEntry; } StringBundler sb = new StringBundler(8); sb.append(_NO_SUCH_ENTITY_WITH_KEY); sb.append("groupId="); sb.append(groupId); sb.append(", userId="); sb.append(userId); sb.append(", status="); sb.append(status); sb.append("}"); throw new NoSuchEntryException(sb.toString()); } /** * Returns the last bookmarks entry in the ordered set where groupId = ? and userId = ? and status = ?. * * @param groupId the group ID * @param userId the user ID * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching bookmarks entry, or null if a matching bookmarks entry could not be found */ @Override public BookmarksEntry fetchByG_U_S_Last( long groupId, long userId, int status, OrderByComparator orderByComparator) { int count = countByG_U_S(groupId, userId, status); if (count == 0) { return null; } List list = findByG_U_S( groupId, userId, status, count - 1, count, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the bookmarks entries before and after the current bookmarks entry in the ordered set where groupId = ? and userId = ? and status = ?. * * @param entryId the primary key of the current bookmarks entry * @param groupId the group ID * @param userId the user ID * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the previous, current, and next bookmarks entry * @throws NoSuchEntryException if a bookmarks entry with the primary key could not be found */ @Override public BookmarksEntry[] findByG_U_S_PrevAndNext( long entryId, long groupId, long userId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BookmarksEntry bookmarksEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BookmarksEntry[] array = new BookmarksEntryImpl[3]; array[0] = getByG_U_S_PrevAndNext( session, bookmarksEntry, groupId, userId, status, orderByComparator, true); array[1] = bookmarksEntry; array[2] = getByG_U_S_PrevAndNext( session, bookmarksEntry, groupId, userId, status, orderByComparator, false); return array; } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } protected BookmarksEntry getByG_U_S_PrevAndNext( Session session, BookmarksEntry bookmarksEntry, long groupId, long userId, int status, OrderByComparator orderByComparator, boolean previous) { StringBundler sb = null; if (orderByComparator != null) { sb = new StringBundler( 6 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { sb = new StringBundler(5); } sb.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_G_U_S_GROUPID_2); sb.append(_FINDER_COLUMN_G_U_S_USERID_2); sb.append(_FINDER_COLUMN_G_U_S_STATUS_2); if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { sb.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { sb.append(_ORDER_BY_ENTITY_ALIAS); sb.append(orderByConditionFields[i]); if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { sb.append(WHERE_GREATER_THAN_HAS_NEXT); } else { sb.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { sb.append(WHERE_GREATER_THAN); } else { sb.append(WHERE_LESSER_THAN); } } } sb.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { sb.append(_ORDER_BY_ENTITY_ALIAS); sb.append(orderByFields[i]); if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { sb.append(ORDER_BY_ASC_HAS_NEXT); } else { sb.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { sb.append(ORDER_BY_ASC); } else { sb.append(ORDER_BY_DESC); } } } } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_JPQL); } String sql = sb.toString(); Query query = session.createQuery(sql); query.setFirstResult(0); query.setMaxResults(2); QueryPos queryPos = QueryPos.getInstance(query); queryPos.add(groupId); queryPos.add(userId); queryPos.add(status); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues( bookmarksEntry)) { queryPos.add(orderByConditionValue); } } List list = query.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Returns all the bookmarks entries that the user has permission to view where groupId = ? and userId = ? and status = ?. * * @param groupId the group ID * @param userId the user ID * @param status the status * @return the matching bookmarks entries that the user has permission to view */ @Override public List filterFindByG_U_S( long groupId, long userId, int status) { return filterFindByG_U_S( groupId, userId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the bookmarks entries that the user has permission to view where groupId = ? and userId = ? and status = ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param userId the user ID * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @return the range of matching bookmarks entries that the user has permission to view */ @Override public List filterFindByG_U_S( long groupId, long userId, int status, int start, int end) { return filterFindByG_U_S(groupId, userId, status, start, end, null); } /** * Returns an ordered range of all the bookmarks entries that the user has permissions to view where groupId = ? and userId = ? and status = ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param userId the user ID * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching bookmarks entries that the user has permission to view */ @Override public List filterFindByG_U_S( long groupId, long userId, int status, int start, int end, OrderByComparator orderByComparator) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByG_U_S( groupId, userId, status, start, end, orderByComparator); } StringBundler sb = null; if (orderByComparator != null) { sb = new StringBundler( 5 + (orderByComparator.getOrderByFields().length * 2)); } else { sb = new StringBundler(6); } if (getDB().isSupportsInlineDistinct()) { sb.append(_FILTER_SQL_SELECT_BOOKMARKSENTRY_WHERE); } else { sb.append( _FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_1); } sb.append(_FINDER_COLUMN_G_U_S_GROUPID_2); sb.append(_FINDER_COLUMN_G_U_S_USERID_2); sb.append(_FINDER_COLUMN_G_U_S_STATUS_2); if (!getDB().isSupportsInlineDistinct()) { sb.append( _FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { if (getDB().isSupportsInlineDistinct()) { appendOrderByComparator( sb, _ORDER_BY_ENTITY_ALIAS, orderByComparator, true); } else { appendOrderByComparator( sb, _ORDER_BY_ENTITY_TABLE, orderByComparator, true); } } else { if (getDB().isSupportsInlineDistinct()) { sb.append(BookmarksEntryModelImpl.ORDER_BY_SQL_INLINE_DISTINCT); } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck( sb.toString(), BookmarksEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery sqlQuery = session.createSynchronizedSQLQuery(sql); if (getDB().isSupportsInlineDistinct()) { sqlQuery.addEntity( _FILTER_ENTITY_ALIAS, BookmarksEntryImpl.class); } else { sqlQuery.addEntity( _FILTER_ENTITY_TABLE, BookmarksEntryImpl.class); } QueryPos queryPos = QueryPos.getInstance(sqlQuery); queryPos.add(groupId); queryPos.add(userId); queryPos.add(status); return (List)QueryUtil.list( sqlQuery, getDialect(), start, end); } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } /** * Returns the bookmarks entries before and after the current bookmarks entry in the ordered set of bookmarks entries that the user has permission to view where groupId = ? and userId = ? and status = ?. * * @param entryId the primary key of the current bookmarks entry * @param groupId the group ID * @param userId the user ID * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the previous, current, and next bookmarks entry * @throws NoSuchEntryException if a bookmarks entry with the primary key could not be found */ @Override public BookmarksEntry[] filterFindByG_U_S_PrevAndNext( long entryId, long groupId, long userId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByG_U_S_PrevAndNext( entryId, groupId, userId, status, orderByComparator); } BookmarksEntry bookmarksEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BookmarksEntry[] array = new BookmarksEntryImpl[3]; array[0] = filterGetByG_U_S_PrevAndNext( session, bookmarksEntry, groupId, userId, status, orderByComparator, true); array[1] = bookmarksEntry; array[2] = filterGetByG_U_S_PrevAndNext( session, bookmarksEntry, groupId, userId, status, orderByComparator, false); return array; } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } protected BookmarksEntry filterGetByG_U_S_PrevAndNext( Session session, BookmarksEntry bookmarksEntry, long groupId, long userId, int status, OrderByComparator orderByComparator, boolean previous) { StringBundler sb = null; if (orderByComparator != null) { sb = new StringBundler( 7 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { sb = new StringBundler(6); } if (getDB().isSupportsInlineDistinct()) { sb.append(_FILTER_SQL_SELECT_BOOKMARKSENTRY_WHERE); } else { sb.append( _FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_1); } sb.append(_FINDER_COLUMN_G_U_S_GROUPID_2); sb.append(_FINDER_COLUMN_G_U_S_USERID_2); sb.append(_FINDER_COLUMN_G_U_S_STATUS_2); if (!getDB().isSupportsInlineDistinct()) { sb.append( _FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { sb.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { if (getDB().isSupportsInlineDistinct()) { sb.append( getColumnName( _ORDER_BY_ENTITY_ALIAS, orderByConditionFields[i], true)); } else { sb.append( getColumnName( _ORDER_BY_ENTITY_TABLE, orderByConditionFields[i], true)); } if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { sb.append(WHERE_GREATER_THAN_HAS_NEXT); } else { sb.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { sb.append(WHERE_GREATER_THAN); } else { sb.append(WHERE_LESSER_THAN); } } } sb.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { if (getDB().isSupportsInlineDistinct()) { sb.append( getColumnName( _ORDER_BY_ENTITY_ALIAS, orderByFields[i], true)); } else { sb.append( getColumnName( _ORDER_BY_ENTITY_TABLE, orderByFields[i], true)); } if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { sb.append(ORDER_BY_ASC_HAS_NEXT); } else { sb.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { sb.append(ORDER_BY_ASC); } else { sb.append(ORDER_BY_DESC); } } } } else { if (getDB().isSupportsInlineDistinct()) { sb.append(BookmarksEntryModelImpl.ORDER_BY_SQL_INLINE_DISTINCT); } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck( sb.toString(), BookmarksEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); SQLQuery sqlQuery = session.createSynchronizedSQLQuery(sql); sqlQuery.setFirstResult(0); sqlQuery.setMaxResults(2); if (getDB().isSupportsInlineDistinct()) { sqlQuery.addEntity(_FILTER_ENTITY_ALIAS, BookmarksEntryImpl.class); } else { sqlQuery.addEntity(_FILTER_ENTITY_TABLE, BookmarksEntryImpl.class); } QueryPos queryPos = QueryPos.getInstance(sqlQuery); queryPos.add(groupId); queryPos.add(userId); queryPos.add(status); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues( bookmarksEntry)) { queryPos.add(orderByConditionValue); } } List list = sqlQuery.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Removes all the bookmarks entries where groupId = ? and userId = ? and status = ? from the database. * * @param groupId the group ID * @param userId the user ID * @param status the status */ @Override public void removeByG_U_S(long groupId, long userId, int status) { for (BookmarksEntry bookmarksEntry : findByG_U_S( groupId, userId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(bookmarksEntry); } } /** * Returns the number of bookmarks entries where groupId = ? and userId = ? and status = ?. * * @param groupId the group ID * @param userId the user ID * @param status the status * @return the number of matching bookmarks entries */ @Override public int countByG_U_S(long groupId, long userId, int status) { try (SafeCloseable safeCloseable = ctPersistenceHelper.setCTCollectionIdWithSafeCloseable( BookmarksEntry.class)) { FinderPath finderPath = _finderPathCountByG_U_S; Object[] finderArgs = new Object[] {groupId, userId, status}; Long count = (Long)finderCache.getResult( finderPath, finderArgs, this); if (count == null) { StringBundler sb = new StringBundler(4); sb.append(_SQL_COUNT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_G_U_S_GROUPID_2); sb.append(_FINDER_COLUMN_G_U_S_USERID_2); sb.append(_FINDER_COLUMN_G_U_S_STATUS_2); String sql = sb.toString(); Session session = null; try { session = openSession(); Query query = session.createQuery(sql); QueryPos queryPos = QueryPos.getInstance(query); queryPos.add(groupId); queryPos.add(userId); queryPos.add(status); count = (Long)query.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } return count.intValue(); } } /** * Returns the number of bookmarks entries that the user has permission to view where groupId = ? and userId = ? and status = ?. * * @param groupId the group ID * @param userId the user ID * @param status the status * @return the number of matching bookmarks entries that the user has permission to view */ @Override public int filterCountByG_U_S(long groupId, long userId, int status) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return countByG_U_S(groupId, userId, status); } StringBundler sb = new StringBundler(4); sb.append(_FILTER_SQL_COUNT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_G_U_S_GROUPID_2); sb.append(_FINDER_COLUMN_G_U_S_USERID_2); sb.append(_FINDER_COLUMN_G_U_S_STATUS_2); String sql = InlineSQLHelperUtil.replacePermissionCheck( sb.toString(), BookmarksEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery sqlQuery = session.createSynchronizedSQLQuery(sql); sqlQuery.addScalar( COUNT_COLUMN_NAME, com.liferay.portal.kernel.dao.orm.Type.LONG); QueryPos queryPos = QueryPos.getInstance(sqlQuery); queryPos.add(groupId); queryPos.add(userId); queryPos.add(status); Long count = (Long)sqlQuery.uniqueResult(); return count.intValue(); } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } private static final String _FINDER_COLUMN_G_U_S_GROUPID_2 = "bookmarksEntry.groupId = ? AND "; private static final String _FINDER_COLUMN_G_U_S_USERID_2 = "bookmarksEntry.userId = ? AND "; private static final String _FINDER_COLUMN_G_U_S_STATUS_2 = "bookmarksEntry.status = ?"; private FinderPath _finderPathWithPaginationFindByG_U_NotS; private FinderPath _finderPathWithPaginationCountByG_U_NotS; /** * Returns all the bookmarks entries where groupId = ? and userId = ? and status ≠ ?. * * @param groupId the group ID * @param userId the user ID * @param status the status * @return the matching bookmarks entries */ @Override public List findByG_U_NotS( long groupId, long userId, int status) { return findByG_U_NotS( groupId, userId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the bookmarks entries where groupId = ? and userId = ? and status ≠ ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param userId the user ID * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @return the range of matching bookmarks entries */ @Override public List findByG_U_NotS( long groupId, long userId, int status, int start, int end) { return findByG_U_NotS(groupId, userId, status, start, end, null); } /** * Returns an ordered range of all the bookmarks entries where groupId = ? and userId = ? and status ≠ ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param userId the user ID * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching bookmarks entries */ @Override public List findByG_U_NotS( long groupId, long userId, int status, int start, int end, OrderByComparator orderByComparator) { return findByG_U_NotS( groupId, userId, status, start, end, orderByComparator, true); } /** * Returns an ordered range of all the bookmarks entries where groupId = ? and userId = ? and status ≠ ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param userId the user ID * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @param useFinderCache whether to use the finder cache * @return the ordered range of matching bookmarks entries */ @Override public List findByG_U_NotS( long groupId, long userId, int status, int start, int end, OrderByComparator orderByComparator, boolean useFinderCache) { try (SafeCloseable safeCloseable = ctPersistenceHelper.setCTCollectionIdWithSafeCloseable( BookmarksEntry.class)) { FinderPath finderPath = null; Object[] finderArgs = null; finderPath = _finderPathWithPaginationFindByG_U_NotS; finderArgs = new Object[] { groupId, userId, status, start, end, orderByComparator }; List list = null; if (useFinderCache) { list = (List)finderCache.getResult( finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (BookmarksEntry bookmarksEntry : list) { if ((groupId != bookmarksEntry.getGroupId()) || (userId != bookmarksEntry.getUserId()) || (status == bookmarksEntry.getStatus())) { list = null; break; } } } } if (list == null) { StringBundler sb = null; if (orderByComparator != null) { sb = new StringBundler( 5 + (orderByComparator.getOrderByFields().length * 2)); } else { sb = new StringBundler(5); } sb.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_G_U_NOTS_GROUPID_2); sb.append(_FINDER_COLUMN_G_U_NOTS_USERID_2); sb.append(_FINDER_COLUMN_G_U_NOTS_STATUS_2); if (orderByComparator != null) { appendOrderByComparator( sb, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_JPQL); } String sql = sb.toString(); Session session = null; try { session = openSession(); Query query = session.createQuery(sql); QueryPos queryPos = QueryPos.getInstance(query); queryPos.add(groupId); queryPos.add(userId); queryPos.add(status); list = (List)QueryUtil.list( query, getDialect(), start, end); cacheResult(list); if (useFinderCache) { finderCache.putResult(finderPath, finderArgs, list); } } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } return list; } } /** * Returns the first bookmarks entry in the ordered set where groupId = ? and userId = ? and status ≠ ?. * * @param groupId the group ID * @param userId the user ID * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching bookmarks entry * @throws NoSuchEntryException if a matching bookmarks entry could not be found */ @Override public BookmarksEntry findByG_U_NotS_First( long groupId, long userId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BookmarksEntry bookmarksEntry = fetchByG_U_NotS_First( groupId, userId, status, orderByComparator); if (bookmarksEntry != null) { return bookmarksEntry; } StringBundler sb = new StringBundler(8); sb.append(_NO_SUCH_ENTITY_WITH_KEY); sb.append("groupId="); sb.append(groupId); sb.append(", userId="); sb.append(userId); sb.append(", status!="); sb.append(status); sb.append("}"); throw new NoSuchEntryException(sb.toString()); } /** * Returns the first bookmarks entry in the ordered set where groupId = ? and userId = ? and status ≠ ?. * * @param groupId the group ID * @param userId the user ID * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching bookmarks entry, or null if a matching bookmarks entry could not be found */ @Override public BookmarksEntry fetchByG_U_NotS_First( long groupId, long userId, int status, OrderByComparator orderByComparator) { List list = findByG_U_NotS( groupId, userId, status, 0, 1, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the last bookmarks entry in the ordered set where groupId = ? and userId = ? and status ≠ ?. * * @param groupId the group ID * @param userId the user ID * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching bookmarks entry * @throws NoSuchEntryException if a matching bookmarks entry could not be found */ @Override public BookmarksEntry findByG_U_NotS_Last( long groupId, long userId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BookmarksEntry bookmarksEntry = fetchByG_U_NotS_Last( groupId, userId, status, orderByComparator); if (bookmarksEntry != null) { return bookmarksEntry; } StringBundler sb = new StringBundler(8); sb.append(_NO_SUCH_ENTITY_WITH_KEY); sb.append("groupId="); sb.append(groupId); sb.append(", userId="); sb.append(userId); sb.append(", status!="); sb.append(status); sb.append("}"); throw new NoSuchEntryException(sb.toString()); } /** * Returns the last bookmarks entry in the ordered set where groupId = ? and userId = ? and status ≠ ?. * * @param groupId the group ID * @param userId the user ID * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching bookmarks entry, or null if a matching bookmarks entry could not be found */ @Override public BookmarksEntry fetchByG_U_NotS_Last( long groupId, long userId, int status, OrderByComparator orderByComparator) { int count = countByG_U_NotS(groupId, userId, status); if (count == 0) { return null; } List list = findByG_U_NotS( groupId, userId, status, count - 1, count, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the bookmarks entries before and after the current bookmarks entry in the ordered set where groupId = ? and userId = ? and status ≠ ?. * * @param entryId the primary key of the current bookmarks entry * @param groupId the group ID * @param userId the user ID * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the previous, current, and next bookmarks entry * @throws NoSuchEntryException if a bookmarks entry with the primary key could not be found */ @Override public BookmarksEntry[] findByG_U_NotS_PrevAndNext( long entryId, long groupId, long userId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BookmarksEntry bookmarksEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BookmarksEntry[] array = new BookmarksEntryImpl[3]; array[0] = getByG_U_NotS_PrevAndNext( session, bookmarksEntry, groupId, userId, status, orderByComparator, true); array[1] = bookmarksEntry; array[2] = getByG_U_NotS_PrevAndNext( session, bookmarksEntry, groupId, userId, status, orderByComparator, false); return array; } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } protected BookmarksEntry getByG_U_NotS_PrevAndNext( Session session, BookmarksEntry bookmarksEntry, long groupId, long userId, int status, OrderByComparator orderByComparator, boolean previous) { StringBundler sb = null; if (orderByComparator != null) { sb = new StringBundler( 6 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { sb = new StringBundler(5); } sb.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_G_U_NOTS_GROUPID_2); sb.append(_FINDER_COLUMN_G_U_NOTS_USERID_2); sb.append(_FINDER_COLUMN_G_U_NOTS_STATUS_2); if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { sb.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { sb.append(_ORDER_BY_ENTITY_ALIAS); sb.append(orderByConditionFields[i]); if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { sb.append(WHERE_GREATER_THAN_HAS_NEXT); } else { sb.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { sb.append(WHERE_GREATER_THAN); } else { sb.append(WHERE_LESSER_THAN); } } } sb.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { sb.append(_ORDER_BY_ENTITY_ALIAS); sb.append(orderByFields[i]); if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { sb.append(ORDER_BY_ASC_HAS_NEXT); } else { sb.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { sb.append(ORDER_BY_ASC); } else { sb.append(ORDER_BY_DESC); } } } } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_JPQL); } String sql = sb.toString(); Query query = session.createQuery(sql); query.setFirstResult(0); query.setMaxResults(2); QueryPos queryPos = QueryPos.getInstance(query); queryPos.add(groupId); queryPos.add(userId); queryPos.add(status); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues( bookmarksEntry)) { queryPos.add(orderByConditionValue); } } List list = query.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Returns all the bookmarks entries that the user has permission to view where groupId = ? and userId = ? and status ≠ ?. * * @param groupId the group ID * @param userId the user ID * @param status the status * @return the matching bookmarks entries that the user has permission to view */ @Override public List filterFindByG_U_NotS( long groupId, long userId, int status) { return filterFindByG_U_NotS( groupId, userId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the bookmarks entries that the user has permission to view where groupId = ? and userId = ? and status ≠ ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param userId the user ID * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @return the range of matching bookmarks entries that the user has permission to view */ @Override public List filterFindByG_U_NotS( long groupId, long userId, int status, int start, int end) { return filterFindByG_U_NotS(groupId, userId, status, start, end, null); } /** * Returns an ordered range of all the bookmarks entries that the user has permissions to view where groupId = ? and userId = ? and status ≠ ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param userId the user ID * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching bookmarks entries that the user has permission to view */ @Override public List filterFindByG_U_NotS( long groupId, long userId, int status, int start, int end, OrderByComparator orderByComparator) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByG_U_NotS( groupId, userId, status, start, end, orderByComparator); } StringBundler sb = null; if (orderByComparator != null) { sb = new StringBundler( 5 + (orderByComparator.getOrderByFields().length * 2)); } else { sb = new StringBundler(6); } if (getDB().isSupportsInlineDistinct()) { sb.append(_FILTER_SQL_SELECT_BOOKMARKSENTRY_WHERE); } else { sb.append( _FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_1); } sb.append(_FINDER_COLUMN_G_U_NOTS_GROUPID_2); sb.append(_FINDER_COLUMN_G_U_NOTS_USERID_2); sb.append(_FINDER_COLUMN_G_U_NOTS_STATUS_2); if (!getDB().isSupportsInlineDistinct()) { sb.append( _FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { if (getDB().isSupportsInlineDistinct()) { appendOrderByComparator( sb, _ORDER_BY_ENTITY_ALIAS, orderByComparator, true); } else { appendOrderByComparator( sb, _ORDER_BY_ENTITY_TABLE, orderByComparator, true); } } else { if (getDB().isSupportsInlineDistinct()) { sb.append(BookmarksEntryModelImpl.ORDER_BY_SQL_INLINE_DISTINCT); } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck( sb.toString(), BookmarksEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery sqlQuery = session.createSynchronizedSQLQuery(sql); if (getDB().isSupportsInlineDistinct()) { sqlQuery.addEntity( _FILTER_ENTITY_ALIAS, BookmarksEntryImpl.class); } else { sqlQuery.addEntity( _FILTER_ENTITY_TABLE, BookmarksEntryImpl.class); } QueryPos queryPos = QueryPos.getInstance(sqlQuery); queryPos.add(groupId); queryPos.add(userId); queryPos.add(status); return (List)QueryUtil.list( sqlQuery, getDialect(), start, end); } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } /** * Returns the bookmarks entries before and after the current bookmarks entry in the ordered set of bookmarks entries that the user has permission to view where groupId = ? and userId = ? and status ≠ ?. * * @param entryId the primary key of the current bookmarks entry * @param groupId the group ID * @param userId the user ID * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the previous, current, and next bookmarks entry * @throws NoSuchEntryException if a bookmarks entry with the primary key could not be found */ @Override public BookmarksEntry[] filterFindByG_U_NotS_PrevAndNext( long entryId, long groupId, long userId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByG_U_NotS_PrevAndNext( entryId, groupId, userId, status, orderByComparator); } BookmarksEntry bookmarksEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BookmarksEntry[] array = new BookmarksEntryImpl[3]; array[0] = filterGetByG_U_NotS_PrevAndNext( session, bookmarksEntry, groupId, userId, status, orderByComparator, true); array[1] = bookmarksEntry; array[2] = filterGetByG_U_NotS_PrevAndNext( session, bookmarksEntry, groupId, userId, status, orderByComparator, false); return array; } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } protected BookmarksEntry filterGetByG_U_NotS_PrevAndNext( Session session, BookmarksEntry bookmarksEntry, long groupId, long userId, int status, OrderByComparator orderByComparator, boolean previous) { StringBundler sb = null; if (orderByComparator != null) { sb = new StringBundler( 7 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { sb = new StringBundler(6); } if (getDB().isSupportsInlineDistinct()) { sb.append(_FILTER_SQL_SELECT_BOOKMARKSENTRY_WHERE); } else { sb.append( _FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_1); } sb.append(_FINDER_COLUMN_G_U_NOTS_GROUPID_2); sb.append(_FINDER_COLUMN_G_U_NOTS_USERID_2); sb.append(_FINDER_COLUMN_G_U_NOTS_STATUS_2); if (!getDB().isSupportsInlineDistinct()) { sb.append( _FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { sb.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { if (getDB().isSupportsInlineDistinct()) { sb.append( getColumnName( _ORDER_BY_ENTITY_ALIAS, orderByConditionFields[i], true)); } else { sb.append( getColumnName( _ORDER_BY_ENTITY_TABLE, orderByConditionFields[i], true)); } if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { sb.append(WHERE_GREATER_THAN_HAS_NEXT); } else { sb.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { sb.append(WHERE_GREATER_THAN); } else { sb.append(WHERE_LESSER_THAN); } } } sb.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { if (getDB().isSupportsInlineDistinct()) { sb.append( getColumnName( _ORDER_BY_ENTITY_ALIAS, orderByFields[i], true)); } else { sb.append( getColumnName( _ORDER_BY_ENTITY_TABLE, orderByFields[i], true)); } if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { sb.append(ORDER_BY_ASC_HAS_NEXT); } else { sb.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { sb.append(ORDER_BY_ASC); } else { sb.append(ORDER_BY_DESC); } } } } else { if (getDB().isSupportsInlineDistinct()) { sb.append(BookmarksEntryModelImpl.ORDER_BY_SQL_INLINE_DISTINCT); } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck( sb.toString(), BookmarksEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); SQLQuery sqlQuery = session.createSynchronizedSQLQuery(sql); sqlQuery.setFirstResult(0); sqlQuery.setMaxResults(2); if (getDB().isSupportsInlineDistinct()) { sqlQuery.addEntity(_FILTER_ENTITY_ALIAS, BookmarksEntryImpl.class); } else { sqlQuery.addEntity(_FILTER_ENTITY_TABLE, BookmarksEntryImpl.class); } QueryPos queryPos = QueryPos.getInstance(sqlQuery); queryPos.add(groupId); queryPos.add(userId); queryPos.add(status); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues( bookmarksEntry)) { queryPos.add(orderByConditionValue); } } List list = sqlQuery.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Removes all the bookmarks entries where groupId = ? and userId = ? and status ≠ ? from the database. * * @param groupId the group ID * @param userId the user ID * @param status the status */ @Override public void removeByG_U_NotS(long groupId, long userId, int status) { for (BookmarksEntry bookmarksEntry : findByG_U_NotS( groupId, userId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(bookmarksEntry); } } /** * Returns the number of bookmarks entries where groupId = ? and userId = ? and status ≠ ?. * * @param groupId the group ID * @param userId the user ID * @param status the status * @return the number of matching bookmarks entries */ @Override public int countByG_U_NotS(long groupId, long userId, int status) { try (SafeCloseable safeCloseable = ctPersistenceHelper.setCTCollectionIdWithSafeCloseable( BookmarksEntry.class)) { FinderPath finderPath = _finderPathWithPaginationCountByG_U_NotS; Object[] finderArgs = new Object[] {groupId, userId, status}; Long count = (Long)finderCache.getResult( finderPath, finderArgs, this); if (count == null) { StringBundler sb = new StringBundler(4); sb.append(_SQL_COUNT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_G_U_NOTS_GROUPID_2); sb.append(_FINDER_COLUMN_G_U_NOTS_USERID_2); sb.append(_FINDER_COLUMN_G_U_NOTS_STATUS_2); String sql = sb.toString(); Session session = null; try { session = openSession(); Query query = session.createQuery(sql); QueryPos queryPos = QueryPos.getInstance(query); queryPos.add(groupId); queryPos.add(userId); queryPos.add(status); count = (Long)query.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } return count.intValue(); } } /** * Returns the number of bookmarks entries that the user has permission to view where groupId = ? and userId = ? and status ≠ ?. * * @param groupId the group ID * @param userId the user ID * @param status the status * @return the number of matching bookmarks entries that the user has permission to view */ @Override public int filterCountByG_U_NotS(long groupId, long userId, int status) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return countByG_U_NotS(groupId, userId, status); } StringBundler sb = new StringBundler(4); sb.append(_FILTER_SQL_COUNT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_G_U_NOTS_GROUPID_2); sb.append(_FINDER_COLUMN_G_U_NOTS_USERID_2); sb.append(_FINDER_COLUMN_G_U_NOTS_STATUS_2); String sql = InlineSQLHelperUtil.replacePermissionCheck( sb.toString(), BookmarksEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery sqlQuery = session.createSynchronizedSQLQuery(sql); sqlQuery.addScalar( COUNT_COLUMN_NAME, com.liferay.portal.kernel.dao.orm.Type.LONG); QueryPos queryPos = QueryPos.getInstance(sqlQuery); queryPos.add(groupId); queryPos.add(userId); queryPos.add(status); Long count = (Long)sqlQuery.uniqueResult(); return count.intValue(); } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } private static final String _FINDER_COLUMN_G_U_NOTS_GROUPID_2 = "bookmarksEntry.groupId = ? AND "; private static final String _FINDER_COLUMN_G_U_NOTS_USERID_2 = "bookmarksEntry.userId = ? AND "; private static final String _FINDER_COLUMN_G_U_NOTS_STATUS_2 = "bookmarksEntry.status != ?"; private FinderPath _finderPathWithPaginationFindByG_F_S; private FinderPath _finderPathWithoutPaginationFindByG_F_S; private FinderPath _finderPathCountByG_F_S; private FinderPath _finderPathWithPaginationCountByG_F_S; /** * Returns all the bookmarks entries where groupId = ? and folderId = ? and status = ?. * * @param groupId the group ID * @param folderId the folder ID * @param status the status * @return the matching bookmarks entries */ @Override public List findByG_F_S( long groupId, long folderId, int status) { return findByG_F_S( groupId, folderId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the bookmarks entries where groupId = ? and folderId = ? and status = ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param folderId the folder ID * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @return the range of matching bookmarks entries */ @Override public List findByG_F_S( long groupId, long folderId, int status, int start, int end) { return findByG_F_S(groupId, folderId, status, start, end, null); } /** * Returns an ordered range of all the bookmarks entries where groupId = ? and folderId = ? and status = ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param folderId the folder ID * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching bookmarks entries */ @Override public List findByG_F_S( long groupId, long folderId, int status, int start, int end, OrderByComparator orderByComparator) { return findByG_F_S( groupId, folderId, status, start, end, orderByComparator, true); } /** * Returns an ordered range of all the bookmarks entries where groupId = ? and folderId = ? and status = ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param folderId the folder ID * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @param useFinderCache whether to use the finder cache * @return the ordered range of matching bookmarks entries */ @Override public List findByG_F_S( long groupId, long folderId, int status, int start, int end, OrderByComparator orderByComparator, boolean useFinderCache) { try (SafeCloseable safeCloseable = ctPersistenceHelper.setCTCollectionIdWithSafeCloseable( BookmarksEntry.class)) { FinderPath finderPath = null; Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { if (useFinderCache) { finderPath = _finderPathWithoutPaginationFindByG_F_S; finderArgs = new Object[] {groupId, folderId, status}; } } else if (useFinderCache) { finderPath = _finderPathWithPaginationFindByG_F_S; finderArgs = new Object[] { groupId, folderId, status, start, end, orderByComparator }; } List list = null; if (useFinderCache) { list = (List)finderCache.getResult( finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (BookmarksEntry bookmarksEntry : list) { if ((groupId != bookmarksEntry.getGroupId()) || (folderId != bookmarksEntry.getFolderId()) || (status != bookmarksEntry.getStatus())) { list = null; break; } } } } if (list == null) { StringBundler sb = null; if (orderByComparator != null) { sb = new StringBundler( 5 + (orderByComparator.getOrderByFields().length * 2)); } else { sb = new StringBundler(5); } sb.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_G_F_S_GROUPID_2); sb.append(_FINDER_COLUMN_G_F_S_FOLDERID_2); sb.append(_FINDER_COLUMN_G_F_S_STATUS_2); if (orderByComparator != null) { appendOrderByComparator( sb, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_JPQL); } String sql = sb.toString(); Session session = null; try { session = openSession(); Query query = session.createQuery(sql); QueryPos queryPos = QueryPos.getInstance(query); queryPos.add(groupId); queryPos.add(folderId); queryPos.add(status); list = (List)QueryUtil.list( query, getDialect(), start, end); cacheResult(list); if (useFinderCache) { finderCache.putResult(finderPath, finderArgs, list); } } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } return list; } } /** * Returns the first bookmarks entry in the ordered set where groupId = ? and folderId = ? and status = ?. * * @param groupId the group ID * @param folderId the folder ID * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching bookmarks entry * @throws NoSuchEntryException if a matching bookmarks entry could not be found */ @Override public BookmarksEntry findByG_F_S_First( long groupId, long folderId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BookmarksEntry bookmarksEntry = fetchByG_F_S_First( groupId, folderId, status, orderByComparator); if (bookmarksEntry != null) { return bookmarksEntry; } StringBundler sb = new StringBundler(8); sb.append(_NO_SUCH_ENTITY_WITH_KEY); sb.append("groupId="); sb.append(groupId); sb.append(", folderId="); sb.append(folderId); sb.append(", status="); sb.append(status); sb.append("}"); throw new NoSuchEntryException(sb.toString()); } /** * Returns the first bookmarks entry in the ordered set where groupId = ? and folderId = ? and status = ?. * * @param groupId the group ID * @param folderId the folder ID * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching bookmarks entry, or null if a matching bookmarks entry could not be found */ @Override public BookmarksEntry fetchByG_F_S_First( long groupId, long folderId, int status, OrderByComparator orderByComparator) { List list = findByG_F_S( groupId, folderId, status, 0, 1, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the last bookmarks entry in the ordered set where groupId = ? and folderId = ? and status = ?. * * @param groupId the group ID * @param folderId the folder ID * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching bookmarks entry * @throws NoSuchEntryException if a matching bookmarks entry could not be found */ @Override public BookmarksEntry findByG_F_S_Last( long groupId, long folderId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BookmarksEntry bookmarksEntry = fetchByG_F_S_Last( groupId, folderId, status, orderByComparator); if (bookmarksEntry != null) { return bookmarksEntry; } StringBundler sb = new StringBundler(8); sb.append(_NO_SUCH_ENTITY_WITH_KEY); sb.append("groupId="); sb.append(groupId); sb.append(", folderId="); sb.append(folderId); sb.append(", status="); sb.append(status); sb.append("}"); throw new NoSuchEntryException(sb.toString()); } /** * Returns the last bookmarks entry in the ordered set where groupId = ? and folderId = ? and status = ?. * * @param groupId the group ID * @param folderId the folder ID * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching bookmarks entry, or null if a matching bookmarks entry could not be found */ @Override public BookmarksEntry fetchByG_F_S_Last( long groupId, long folderId, int status, OrderByComparator orderByComparator) { int count = countByG_F_S(groupId, folderId, status); if (count == 0) { return null; } List list = findByG_F_S( groupId, folderId, status, count - 1, count, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the bookmarks entries before and after the current bookmarks entry in the ordered set where groupId = ? and folderId = ? and status = ?. * * @param entryId the primary key of the current bookmarks entry * @param groupId the group ID * @param folderId the folder ID * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the previous, current, and next bookmarks entry * @throws NoSuchEntryException if a bookmarks entry with the primary key could not be found */ @Override public BookmarksEntry[] findByG_F_S_PrevAndNext( long entryId, long groupId, long folderId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BookmarksEntry bookmarksEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BookmarksEntry[] array = new BookmarksEntryImpl[3]; array[0] = getByG_F_S_PrevAndNext( session, bookmarksEntry, groupId, folderId, status, orderByComparator, true); array[1] = bookmarksEntry; array[2] = getByG_F_S_PrevAndNext( session, bookmarksEntry, groupId, folderId, status, orderByComparator, false); return array; } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } protected BookmarksEntry getByG_F_S_PrevAndNext( Session session, BookmarksEntry bookmarksEntry, long groupId, long folderId, int status, OrderByComparator orderByComparator, boolean previous) { StringBundler sb = null; if (orderByComparator != null) { sb = new StringBundler( 6 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { sb = new StringBundler(5); } sb.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_G_F_S_GROUPID_2); sb.append(_FINDER_COLUMN_G_F_S_FOLDERID_2); sb.append(_FINDER_COLUMN_G_F_S_STATUS_2); if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { sb.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { sb.append(_ORDER_BY_ENTITY_ALIAS); sb.append(orderByConditionFields[i]); if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { sb.append(WHERE_GREATER_THAN_HAS_NEXT); } else { sb.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { sb.append(WHERE_GREATER_THAN); } else { sb.append(WHERE_LESSER_THAN); } } } sb.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { sb.append(_ORDER_BY_ENTITY_ALIAS); sb.append(orderByFields[i]); if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { sb.append(ORDER_BY_ASC_HAS_NEXT); } else { sb.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { sb.append(ORDER_BY_ASC); } else { sb.append(ORDER_BY_DESC); } } } } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_JPQL); } String sql = sb.toString(); Query query = session.createQuery(sql); query.setFirstResult(0); query.setMaxResults(2); QueryPos queryPos = QueryPos.getInstance(query); queryPos.add(groupId); queryPos.add(folderId); queryPos.add(status); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues( bookmarksEntry)) { queryPos.add(orderByConditionValue); } } List list = query.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Returns all the bookmarks entries that the user has permission to view where groupId = ? and folderId = ? and status = ?. * * @param groupId the group ID * @param folderId the folder ID * @param status the status * @return the matching bookmarks entries that the user has permission to view */ @Override public List filterFindByG_F_S( long groupId, long folderId, int status) { return filterFindByG_F_S( groupId, folderId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the bookmarks entries that the user has permission to view where groupId = ? and folderId = ? and status = ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param folderId the folder ID * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @return the range of matching bookmarks entries that the user has permission to view */ @Override public List filterFindByG_F_S( long groupId, long folderId, int status, int start, int end) { return filterFindByG_F_S(groupId, folderId, status, start, end, null); } /** * Returns an ordered range of all the bookmarks entries that the user has permissions to view where groupId = ? and folderId = ? and status = ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param folderId the folder ID * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching bookmarks entries that the user has permission to view */ @Override public List filterFindByG_F_S( long groupId, long folderId, int status, int start, int end, OrderByComparator orderByComparator) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByG_F_S( groupId, folderId, status, start, end, orderByComparator); } StringBundler sb = null; if (orderByComparator != null) { sb = new StringBundler( 5 + (orderByComparator.getOrderByFields().length * 2)); } else { sb = new StringBundler(6); } if (getDB().isSupportsInlineDistinct()) { sb.append(_FILTER_SQL_SELECT_BOOKMARKSENTRY_WHERE); } else { sb.append( _FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_1); } sb.append(_FINDER_COLUMN_G_F_S_GROUPID_2); sb.append(_FINDER_COLUMN_G_F_S_FOLDERID_2); sb.append(_FINDER_COLUMN_G_F_S_STATUS_2); if (!getDB().isSupportsInlineDistinct()) { sb.append( _FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { if (getDB().isSupportsInlineDistinct()) { appendOrderByComparator( sb, _ORDER_BY_ENTITY_ALIAS, orderByComparator, true); } else { appendOrderByComparator( sb, _ORDER_BY_ENTITY_TABLE, orderByComparator, true); } } else { if (getDB().isSupportsInlineDistinct()) { sb.append(BookmarksEntryModelImpl.ORDER_BY_SQL_INLINE_DISTINCT); } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck( sb.toString(), BookmarksEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery sqlQuery = session.createSynchronizedSQLQuery(sql); if (getDB().isSupportsInlineDistinct()) { sqlQuery.addEntity( _FILTER_ENTITY_ALIAS, BookmarksEntryImpl.class); } else { sqlQuery.addEntity( _FILTER_ENTITY_TABLE, BookmarksEntryImpl.class); } QueryPos queryPos = QueryPos.getInstance(sqlQuery); queryPos.add(groupId); queryPos.add(folderId); queryPos.add(status); return (List)QueryUtil.list( sqlQuery, getDialect(), start, end); } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } /** * Returns the bookmarks entries before and after the current bookmarks entry in the ordered set of bookmarks entries that the user has permission to view where groupId = ? and folderId = ? and status = ?. * * @param entryId the primary key of the current bookmarks entry * @param groupId the group ID * @param folderId the folder ID * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the previous, current, and next bookmarks entry * @throws NoSuchEntryException if a bookmarks entry with the primary key could not be found */ @Override public BookmarksEntry[] filterFindByG_F_S_PrevAndNext( long entryId, long groupId, long folderId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByG_F_S_PrevAndNext( entryId, groupId, folderId, status, orderByComparator); } BookmarksEntry bookmarksEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BookmarksEntry[] array = new BookmarksEntryImpl[3]; array[0] = filterGetByG_F_S_PrevAndNext( session, bookmarksEntry, groupId, folderId, status, orderByComparator, true); array[1] = bookmarksEntry; array[2] = filterGetByG_F_S_PrevAndNext( session, bookmarksEntry, groupId, folderId, status, orderByComparator, false); return array; } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } protected BookmarksEntry filterGetByG_F_S_PrevAndNext( Session session, BookmarksEntry bookmarksEntry, long groupId, long folderId, int status, OrderByComparator orderByComparator, boolean previous) { StringBundler sb = null; if (orderByComparator != null) { sb = new StringBundler( 7 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { sb = new StringBundler(6); } if (getDB().isSupportsInlineDistinct()) { sb.append(_FILTER_SQL_SELECT_BOOKMARKSENTRY_WHERE); } else { sb.append( _FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_1); } sb.append(_FINDER_COLUMN_G_F_S_GROUPID_2); sb.append(_FINDER_COLUMN_G_F_S_FOLDERID_2); sb.append(_FINDER_COLUMN_G_F_S_STATUS_2); if (!getDB().isSupportsInlineDistinct()) { sb.append( _FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { sb.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { if (getDB().isSupportsInlineDistinct()) { sb.append( getColumnName( _ORDER_BY_ENTITY_ALIAS, orderByConditionFields[i], true)); } else { sb.append( getColumnName( _ORDER_BY_ENTITY_TABLE, orderByConditionFields[i], true)); } if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { sb.append(WHERE_GREATER_THAN_HAS_NEXT); } else { sb.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { sb.append(WHERE_GREATER_THAN); } else { sb.append(WHERE_LESSER_THAN); } } } sb.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { if (getDB().isSupportsInlineDistinct()) { sb.append( getColumnName( _ORDER_BY_ENTITY_ALIAS, orderByFields[i], true)); } else { sb.append( getColumnName( _ORDER_BY_ENTITY_TABLE, orderByFields[i], true)); } if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { sb.append(ORDER_BY_ASC_HAS_NEXT); } else { sb.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { sb.append(ORDER_BY_ASC); } else { sb.append(ORDER_BY_DESC); } } } } else { if (getDB().isSupportsInlineDistinct()) { sb.append(BookmarksEntryModelImpl.ORDER_BY_SQL_INLINE_DISTINCT); } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck( sb.toString(), BookmarksEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); SQLQuery sqlQuery = session.createSynchronizedSQLQuery(sql); sqlQuery.setFirstResult(0); sqlQuery.setMaxResults(2); if (getDB().isSupportsInlineDistinct()) { sqlQuery.addEntity(_FILTER_ENTITY_ALIAS, BookmarksEntryImpl.class); } else { sqlQuery.addEntity(_FILTER_ENTITY_TABLE, BookmarksEntryImpl.class); } QueryPos queryPos = QueryPos.getInstance(sqlQuery); queryPos.add(groupId); queryPos.add(folderId); queryPos.add(status); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues( bookmarksEntry)) { queryPos.add(orderByConditionValue); } } List list = sqlQuery.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Returns all the bookmarks entries that the user has permission to view where groupId = ? and folderId = any ? and status = ?. * * @param groupId the group ID * @param folderIds the folder IDs * @param status the status * @return the matching bookmarks entries that the user has permission to view */ @Override public List filterFindByG_F_S( long groupId, long[] folderIds, int status) { return filterFindByG_F_S( groupId, folderIds, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the bookmarks entries that the user has permission to view where groupId = ? and folderId = any ? and status = ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param folderIds the folder IDs * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @return the range of matching bookmarks entries that the user has permission to view */ @Override public List filterFindByG_F_S( long groupId, long[] folderIds, int status, int start, int end) { return filterFindByG_F_S(groupId, folderIds, status, start, end, null); } /** * Returns an ordered range of all the bookmarks entries that the user has permission to view where groupId = ? and folderId = any ? and status = ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param folderIds the folder IDs * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching bookmarks entries that the user has permission to view */ @Override public List filterFindByG_F_S( long groupId, long[] folderIds, int status, int start, int end, OrderByComparator orderByComparator) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByG_F_S( groupId, folderIds, status, start, end, orderByComparator); } if (folderIds == null) { folderIds = new long[0]; } else if (folderIds.length > 1) { folderIds = ArrayUtil.sortedUnique(folderIds); } StringBundler sb = new StringBundler(); if (getDB().isSupportsInlineDistinct()) { sb.append(_FILTER_SQL_SELECT_BOOKMARKSENTRY_WHERE); } else { sb.append( _FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_1); } sb.append(_FINDER_COLUMN_G_F_S_GROUPID_2); if (folderIds.length > 0) { sb.append("("); sb.append(_FINDER_COLUMN_G_F_S_FOLDERID_7); sb.append(StringUtil.merge(folderIds)); sb.append(")"); sb.append(")"); sb.append(WHERE_AND); } sb.append(_FINDER_COLUMN_G_F_S_STATUS_2); sb.setStringAt( removeConjunction(sb.stringAt(sb.index() - 1)), sb.index() - 1); if (!getDB().isSupportsInlineDistinct()) { sb.append( _FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { if (getDB().isSupportsInlineDistinct()) { appendOrderByComparator( sb, _ORDER_BY_ENTITY_ALIAS, orderByComparator, true); } else { appendOrderByComparator( sb, _ORDER_BY_ENTITY_TABLE, orderByComparator, true); } } else { if (getDB().isSupportsInlineDistinct()) { sb.append(BookmarksEntryModelImpl.ORDER_BY_SQL_INLINE_DISTINCT); } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck( sb.toString(), BookmarksEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery sqlQuery = session.createSynchronizedSQLQuery(sql); if (getDB().isSupportsInlineDistinct()) { sqlQuery.addEntity( _FILTER_ENTITY_ALIAS, BookmarksEntryImpl.class); } else { sqlQuery.addEntity( _FILTER_ENTITY_TABLE, BookmarksEntryImpl.class); } QueryPos queryPos = QueryPos.getInstance(sqlQuery); queryPos.add(groupId); queryPos.add(status); return (List)QueryUtil.list( sqlQuery, getDialect(), start, end); } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } /** * Returns all the bookmarks entries where groupId = ? and folderId = any ? and status = ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param folderIds the folder IDs * @param status the status * @return the matching bookmarks entries */ @Override public List findByG_F_S( long groupId, long[] folderIds, int status) { return findByG_F_S( groupId, folderIds, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the bookmarks entries where groupId = ? and folderId = any ? and status = ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param folderIds the folder IDs * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @return the range of matching bookmarks entries */ @Override public List findByG_F_S( long groupId, long[] folderIds, int status, int start, int end) { return findByG_F_S(groupId, folderIds, status, start, end, null); } /** * Returns an ordered range of all the bookmarks entries where groupId = ? and folderId = any ? and status = ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param folderIds the folder IDs * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching bookmarks entries */ @Override public List findByG_F_S( long groupId, long[] folderIds, int status, int start, int end, OrderByComparator orderByComparator) { return findByG_F_S( groupId, folderIds, status, start, end, orderByComparator, true); } /** * Returns an ordered range of all the bookmarks entries where groupId = ? and folderId = ? and status = ?, optionally using the finder cache. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param folderIds the folder IDs * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @param useFinderCache whether to use the finder cache * @return the ordered range of matching bookmarks entries */ @Override public List findByG_F_S( long groupId, long[] folderIds, int status, int start, int end, OrderByComparator orderByComparator, boolean useFinderCache) { if (folderIds == null) { folderIds = new long[0]; } else if (folderIds.length > 1) { folderIds = ArrayUtil.sortedUnique(folderIds); } if (folderIds.length == 1) { return findByG_F_S( groupId, folderIds[0], status, start, end, orderByComparator); } try (SafeCloseable safeCloseable = ctPersistenceHelper.setCTCollectionIdWithSafeCloseable( BookmarksEntry.class)) { Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { if (useFinderCache) { finderArgs = new Object[] { groupId, StringUtil.merge(folderIds), status }; } } else if (useFinderCache) { finderArgs = new Object[] { groupId, StringUtil.merge(folderIds), status, start, end, orderByComparator }; } List list = null; if (useFinderCache) { list = (List)finderCache.getResult( _finderPathWithPaginationFindByG_F_S, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (BookmarksEntry bookmarksEntry : list) { if ((groupId != bookmarksEntry.getGroupId()) || !ArrayUtil.contains( folderIds, bookmarksEntry.getFolderId()) || (status != bookmarksEntry.getStatus())) { list = null; break; } } } } if (list == null) { StringBundler sb = new StringBundler(); sb.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_G_F_S_GROUPID_2); if (folderIds.length > 0) { sb.append("("); sb.append(_FINDER_COLUMN_G_F_S_FOLDERID_7); sb.append(StringUtil.merge(folderIds)); sb.append(")"); sb.append(")"); sb.append(WHERE_AND); } sb.append(_FINDER_COLUMN_G_F_S_STATUS_2); sb.setStringAt( removeConjunction(sb.stringAt(sb.index() - 1)), sb.index() - 1); if (orderByComparator != null) { appendOrderByComparator( sb, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_JPQL); } String sql = sb.toString(); Session session = null; try { session = openSession(); Query query = session.createQuery(sql); QueryPos queryPos = QueryPos.getInstance(query); queryPos.add(groupId); queryPos.add(status); list = (List)QueryUtil.list( query, getDialect(), start, end); cacheResult(list); if (useFinderCache) { finderCache.putResult( _finderPathWithPaginationFindByG_F_S, finderArgs, list); } } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } return list; } } /** * Removes all the bookmarks entries where groupId = ? and folderId = ? and status = ? from the database. * * @param groupId the group ID * @param folderId the folder ID * @param status the status */ @Override public void removeByG_F_S(long groupId, long folderId, int status) { for (BookmarksEntry bookmarksEntry : findByG_F_S( groupId, folderId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(bookmarksEntry); } } /** * Returns the number of bookmarks entries where groupId = ? and folderId = ? and status = ?. * * @param groupId the group ID * @param folderId the folder ID * @param status the status * @return the number of matching bookmarks entries */ @Override public int countByG_F_S(long groupId, long folderId, int status) { try (SafeCloseable safeCloseable = ctPersistenceHelper.setCTCollectionIdWithSafeCloseable( BookmarksEntry.class)) { FinderPath finderPath = _finderPathCountByG_F_S; Object[] finderArgs = new Object[] {groupId, folderId, status}; Long count = (Long)finderCache.getResult( finderPath, finderArgs, this); if (count == null) { StringBundler sb = new StringBundler(4); sb.append(_SQL_COUNT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_G_F_S_GROUPID_2); sb.append(_FINDER_COLUMN_G_F_S_FOLDERID_2); sb.append(_FINDER_COLUMN_G_F_S_STATUS_2); String sql = sb.toString(); Session session = null; try { session = openSession(); Query query = session.createQuery(sql); QueryPos queryPos = QueryPos.getInstance(query); queryPos.add(groupId); queryPos.add(folderId); queryPos.add(status); count = (Long)query.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } return count.intValue(); } } /** * Returns the number of bookmarks entries where groupId = ? and folderId = any ? and status = ?. * * @param groupId the group ID * @param folderIds the folder IDs * @param status the status * @return the number of matching bookmarks entries */ @Override public int countByG_F_S(long groupId, long[] folderIds, int status) { if (folderIds == null) { folderIds = new long[0]; } else if (folderIds.length > 1) { folderIds = ArrayUtil.sortedUnique(folderIds); } try (SafeCloseable safeCloseable = ctPersistenceHelper.setCTCollectionIdWithSafeCloseable( BookmarksEntry.class)) { Object[] finderArgs = new Object[] { groupId, StringUtil.merge(folderIds), status }; Long count = (Long)finderCache.getResult( _finderPathWithPaginationCountByG_F_S, finderArgs, this); if (count == null) { StringBundler sb = new StringBundler(); sb.append(_SQL_COUNT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_G_F_S_GROUPID_2); if (folderIds.length > 0) { sb.append("("); sb.append(_FINDER_COLUMN_G_F_S_FOLDERID_7); sb.append(StringUtil.merge(folderIds)); sb.append(")"); sb.append(")"); sb.append(WHERE_AND); } sb.append(_FINDER_COLUMN_G_F_S_STATUS_2); sb.setStringAt( removeConjunction(sb.stringAt(sb.index() - 1)), sb.index() - 1); String sql = sb.toString(); Session session = null; try { session = openSession(); Query query = session.createQuery(sql); QueryPos queryPos = QueryPos.getInstance(query); queryPos.add(groupId); queryPos.add(status); count = (Long)query.uniqueResult(); finderCache.putResult( _finderPathWithPaginationCountByG_F_S, finderArgs, count); } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } return count.intValue(); } } /** * Returns the number of bookmarks entries that the user has permission to view where groupId = ? and folderId = ? and status = ?. * * @param groupId the group ID * @param folderId the folder ID * @param status the status * @return the number of matching bookmarks entries that the user has permission to view */ @Override public int filterCountByG_F_S(long groupId, long folderId, int status) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return countByG_F_S(groupId, folderId, status); } StringBundler sb = new StringBundler(4); sb.append(_FILTER_SQL_COUNT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_G_F_S_GROUPID_2); sb.append(_FINDER_COLUMN_G_F_S_FOLDERID_2); sb.append(_FINDER_COLUMN_G_F_S_STATUS_2); String sql = InlineSQLHelperUtil.replacePermissionCheck( sb.toString(), BookmarksEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery sqlQuery = session.createSynchronizedSQLQuery(sql); sqlQuery.addScalar( COUNT_COLUMN_NAME, com.liferay.portal.kernel.dao.orm.Type.LONG); QueryPos queryPos = QueryPos.getInstance(sqlQuery); queryPos.add(groupId); queryPos.add(folderId); queryPos.add(status); Long count = (Long)sqlQuery.uniqueResult(); return count.intValue(); } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } /** * Returns the number of bookmarks entries that the user has permission to view where groupId = ? and folderId = any ? and status = ?. * * @param groupId the group ID * @param folderIds the folder IDs * @param status the status * @return the number of matching bookmarks entries that the user has permission to view */ @Override public int filterCountByG_F_S(long groupId, long[] folderIds, int status) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return countByG_F_S(groupId, folderIds, status); } if (folderIds == null) { folderIds = new long[0]; } else if (folderIds.length > 1) { folderIds = ArrayUtil.sortedUnique(folderIds); } StringBundler sb = new StringBundler(); sb.append(_FILTER_SQL_COUNT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_G_F_S_GROUPID_2); if (folderIds.length > 0) { sb.append("("); sb.append(_FINDER_COLUMN_G_F_S_FOLDERID_7); sb.append(StringUtil.merge(folderIds)); sb.append(")"); sb.append(")"); sb.append(WHERE_AND); } sb.append(_FINDER_COLUMN_G_F_S_STATUS_2); sb.setStringAt( removeConjunction(sb.stringAt(sb.index() - 1)), sb.index() - 1); String sql = InlineSQLHelperUtil.replacePermissionCheck( sb.toString(), BookmarksEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery sqlQuery = session.createSynchronizedSQLQuery(sql); sqlQuery.addScalar( COUNT_COLUMN_NAME, com.liferay.portal.kernel.dao.orm.Type.LONG); QueryPos queryPos = QueryPos.getInstance(sqlQuery); queryPos.add(groupId); queryPos.add(status); Long count = (Long)sqlQuery.uniqueResult(); return count.intValue(); } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } private static final String _FINDER_COLUMN_G_F_S_GROUPID_2 = "bookmarksEntry.groupId = ? AND "; private static final String _FINDER_COLUMN_G_F_S_FOLDERID_2 = "bookmarksEntry.folderId = ? AND "; private static final String _FINDER_COLUMN_G_F_S_FOLDERID_7 = "bookmarksEntry.folderId IN ("; private static final String _FINDER_COLUMN_G_F_S_STATUS_2 = "bookmarksEntry.status = ?"; private FinderPath _finderPathWithPaginationFindByG_F_NotS; private FinderPath _finderPathWithPaginationCountByG_F_NotS; /** * Returns all the bookmarks entries where groupId = ? and folderId = ? and status ≠ ?. * * @param groupId the group ID * @param folderId the folder ID * @param status the status * @return the matching bookmarks entries */ @Override public List findByG_F_NotS( long groupId, long folderId, int status) { return findByG_F_NotS( groupId, folderId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the bookmarks entries where groupId = ? and folderId = ? and status ≠ ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param folderId the folder ID * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @return the range of matching bookmarks entries */ @Override public List findByG_F_NotS( long groupId, long folderId, int status, int start, int end) { return findByG_F_NotS(groupId, folderId, status, start, end, null); } /** * Returns an ordered range of all the bookmarks entries where groupId = ? and folderId = ? and status ≠ ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param folderId the folder ID * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching bookmarks entries */ @Override public List findByG_F_NotS( long groupId, long folderId, int status, int start, int end, OrderByComparator orderByComparator) { return findByG_F_NotS( groupId, folderId, status, start, end, orderByComparator, true); } /** * Returns an ordered range of all the bookmarks entries where groupId = ? and folderId = ? and status ≠ ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param folderId the folder ID * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @param useFinderCache whether to use the finder cache * @return the ordered range of matching bookmarks entries */ @Override public List findByG_F_NotS( long groupId, long folderId, int status, int start, int end, OrderByComparator orderByComparator, boolean useFinderCache) { try (SafeCloseable safeCloseable = ctPersistenceHelper.setCTCollectionIdWithSafeCloseable( BookmarksEntry.class)) { FinderPath finderPath = null; Object[] finderArgs = null; finderPath = _finderPathWithPaginationFindByG_F_NotS; finderArgs = new Object[] { groupId, folderId, status, start, end, orderByComparator }; List list = null; if (useFinderCache) { list = (List)finderCache.getResult( finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (BookmarksEntry bookmarksEntry : list) { if ((groupId != bookmarksEntry.getGroupId()) || (folderId != bookmarksEntry.getFolderId()) || (status == bookmarksEntry.getStatus())) { list = null; break; } } } } if (list == null) { StringBundler sb = null; if (orderByComparator != null) { sb = new StringBundler( 5 + (orderByComparator.getOrderByFields().length * 2)); } else { sb = new StringBundler(5); } sb.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_G_F_NOTS_GROUPID_2); sb.append(_FINDER_COLUMN_G_F_NOTS_FOLDERID_2); sb.append(_FINDER_COLUMN_G_F_NOTS_STATUS_2); if (orderByComparator != null) { appendOrderByComparator( sb, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_JPQL); } String sql = sb.toString(); Session session = null; try { session = openSession(); Query query = session.createQuery(sql); QueryPos queryPos = QueryPos.getInstance(query); queryPos.add(groupId); queryPos.add(folderId); queryPos.add(status); list = (List)QueryUtil.list( query, getDialect(), start, end); cacheResult(list); if (useFinderCache) { finderCache.putResult(finderPath, finderArgs, list); } } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } return list; } } /** * Returns the first bookmarks entry in the ordered set where groupId = ? and folderId = ? and status ≠ ?. * * @param groupId the group ID * @param folderId the folder ID * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching bookmarks entry * @throws NoSuchEntryException if a matching bookmarks entry could not be found */ @Override public BookmarksEntry findByG_F_NotS_First( long groupId, long folderId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BookmarksEntry bookmarksEntry = fetchByG_F_NotS_First( groupId, folderId, status, orderByComparator); if (bookmarksEntry != null) { return bookmarksEntry; } StringBundler sb = new StringBundler(8); sb.append(_NO_SUCH_ENTITY_WITH_KEY); sb.append("groupId="); sb.append(groupId); sb.append(", folderId="); sb.append(folderId); sb.append(", status!="); sb.append(status); sb.append("}"); throw new NoSuchEntryException(sb.toString()); } /** * Returns the first bookmarks entry in the ordered set where groupId = ? and folderId = ? and status ≠ ?. * * @param groupId the group ID * @param folderId the folder ID * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching bookmarks entry, or null if a matching bookmarks entry could not be found */ @Override public BookmarksEntry fetchByG_F_NotS_First( long groupId, long folderId, int status, OrderByComparator orderByComparator) { List list = findByG_F_NotS( groupId, folderId, status, 0, 1, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the last bookmarks entry in the ordered set where groupId = ? and folderId = ? and status ≠ ?. * * @param groupId the group ID * @param folderId the folder ID * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching bookmarks entry * @throws NoSuchEntryException if a matching bookmarks entry could not be found */ @Override public BookmarksEntry findByG_F_NotS_Last( long groupId, long folderId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BookmarksEntry bookmarksEntry = fetchByG_F_NotS_Last( groupId, folderId, status, orderByComparator); if (bookmarksEntry != null) { return bookmarksEntry; } StringBundler sb = new StringBundler(8); sb.append(_NO_SUCH_ENTITY_WITH_KEY); sb.append("groupId="); sb.append(groupId); sb.append(", folderId="); sb.append(folderId); sb.append(", status!="); sb.append(status); sb.append("}"); throw new NoSuchEntryException(sb.toString()); } /** * Returns the last bookmarks entry in the ordered set where groupId = ? and folderId = ? and status ≠ ?. * * @param groupId the group ID * @param folderId the folder ID * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching bookmarks entry, or null if a matching bookmarks entry could not be found */ @Override public BookmarksEntry fetchByG_F_NotS_Last( long groupId, long folderId, int status, OrderByComparator orderByComparator) { int count = countByG_F_NotS(groupId, folderId, status); if (count == 0) { return null; } List list = findByG_F_NotS( groupId, folderId, status, count - 1, count, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the bookmarks entries before and after the current bookmarks entry in the ordered set where groupId = ? and folderId = ? and status ≠ ?. * * @param entryId the primary key of the current bookmarks entry * @param groupId the group ID * @param folderId the folder ID * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the previous, current, and next bookmarks entry * @throws NoSuchEntryException if a bookmarks entry with the primary key could not be found */ @Override public BookmarksEntry[] findByG_F_NotS_PrevAndNext( long entryId, long groupId, long folderId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BookmarksEntry bookmarksEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BookmarksEntry[] array = new BookmarksEntryImpl[3]; array[0] = getByG_F_NotS_PrevAndNext( session, bookmarksEntry, groupId, folderId, status, orderByComparator, true); array[1] = bookmarksEntry; array[2] = getByG_F_NotS_PrevAndNext( session, bookmarksEntry, groupId, folderId, status, orderByComparator, false); return array; } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } protected BookmarksEntry getByG_F_NotS_PrevAndNext( Session session, BookmarksEntry bookmarksEntry, long groupId, long folderId, int status, OrderByComparator orderByComparator, boolean previous) { StringBundler sb = null; if (orderByComparator != null) { sb = new StringBundler( 6 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { sb = new StringBundler(5); } sb.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_G_F_NOTS_GROUPID_2); sb.append(_FINDER_COLUMN_G_F_NOTS_FOLDERID_2); sb.append(_FINDER_COLUMN_G_F_NOTS_STATUS_2); if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { sb.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { sb.append(_ORDER_BY_ENTITY_ALIAS); sb.append(orderByConditionFields[i]); if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { sb.append(WHERE_GREATER_THAN_HAS_NEXT); } else { sb.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { sb.append(WHERE_GREATER_THAN); } else { sb.append(WHERE_LESSER_THAN); } } } sb.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { sb.append(_ORDER_BY_ENTITY_ALIAS); sb.append(orderByFields[i]); if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { sb.append(ORDER_BY_ASC_HAS_NEXT); } else { sb.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { sb.append(ORDER_BY_ASC); } else { sb.append(ORDER_BY_DESC); } } } } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_JPQL); } String sql = sb.toString(); Query query = session.createQuery(sql); query.setFirstResult(0); query.setMaxResults(2); QueryPos queryPos = QueryPos.getInstance(query); queryPos.add(groupId); queryPos.add(folderId); queryPos.add(status); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues( bookmarksEntry)) { queryPos.add(orderByConditionValue); } } List list = query.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Returns all the bookmarks entries that the user has permission to view where groupId = ? and folderId = ? and status ≠ ?. * * @param groupId the group ID * @param folderId the folder ID * @param status the status * @return the matching bookmarks entries that the user has permission to view */ @Override public List filterFindByG_F_NotS( long groupId, long folderId, int status) { return filterFindByG_F_NotS( groupId, folderId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the bookmarks entries that the user has permission to view where groupId = ? and folderId = ? and status ≠ ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param folderId the folder ID * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @return the range of matching bookmarks entries that the user has permission to view */ @Override public List filterFindByG_F_NotS( long groupId, long folderId, int status, int start, int end) { return filterFindByG_F_NotS( groupId, folderId, status, start, end, null); } /** * Returns an ordered range of all the bookmarks entries that the user has permissions to view where groupId = ? and folderId = ? and status ≠ ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param folderId the folder ID * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching bookmarks entries that the user has permission to view */ @Override public List filterFindByG_F_NotS( long groupId, long folderId, int status, int start, int end, OrderByComparator orderByComparator) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByG_F_NotS( groupId, folderId, status, start, end, orderByComparator); } StringBundler sb = null; if (orderByComparator != null) { sb = new StringBundler( 5 + (orderByComparator.getOrderByFields().length * 2)); } else { sb = new StringBundler(6); } if (getDB().isSupportsInlineDistinct()) { sb.append(_FILTER_SQL_SELECT_BOOKMARKSENTRY_WHERE); } else { sb.append( _FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_1); } sb.append(_FINDER_COLUMN_G_F_NOTS_GROUPID_2); sb.append(_FINDER_COLUMN_G_F_NOTS_FOLDERID_2); sb.append(_FINDER_COLUMN_G_F_NOTS_STATUS_2); if (!getDB().isSupportsInlineDistinct()) { sb.append( _FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { if (getDB().isSupportsInlineDistinct()) { appendOrderByComparator( sb, _ORDER_BY_ENTITY_ALIAS, orderByComparator, true); } else { appendOrderByComparator( sb, _ORDER_BY_ENTITY_TABLE, orderByComparator, true); } } else { if (getDB().isSupportsInlineDistinct()) { sb.append(BookmarksEntryModelImpl.ORDER_BY_SQL_INLINE_DISTINCT); } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck( sb.toString(), BookmarksEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery sqlQuery = session.createSynchronizedSQLQuery(sql); if (getDB().isSupportsInlineDistinct()) { sqlQuery.addEntity( _FILTER_ENTITY_ALIAS, BookmarksEntryImpl.class); } else { sqlQuery.addEntity( _FILTER_ENTITY_TABLE, BookmarksEntryImpl.class); } QueryPos queryPos = QueryPos.getInstance(sqlQuery); queryPos.add(groupId); queryPos.add(folderId); queryPos.add(status); return (List)QueryUtil.list( sqlQuery, getDialect(), start, end); } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } /** * Returns the bookmarks entries before and after the current bookmarks entry in the ordered set of bookmarks entries that the user has permission to view where groupId = ? and folderId = ? and status ≠ ?. * * @param entryId the primary key of the current bookmarks entry * @param groupId the group ID * @param folderId the folder ID * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the previous, current, and next bookmarks entry * @throws NoSuchEntryException if a bookmarks entry with the primary key could not be found */ @Override public BookmarksEntry[] filterFindByG_F_NotS_PrevAndNext( long entryId, long groupId, long folderId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByG_F_NotS_PrevAndNext( entryId, groupId, folderId, status, orderByComparator); } BookmarksEntry bookmarksEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BookmarksEntry[] array = new BookmarksEntryImpl[3]; array[0] = filterGetByG_F_NotS_PrevAndNext( session, bookmarksEntry, groupId, folderId, status, orderByComparator, true); array[1] = bookmarksEntry; array[2] = filterGetByG_F_NotS_PrevAndNext( session, bookmarksEntry, groupId, folderId, status, orderByComparator, false); return array; } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } protected BookmarksEntry filterGetByG_F_NotS_PrevAndNext( Session session, BookmarksEntry bookmarksEntry, long groupId, long folderId, int status, OrderByComparator orderByComparator, boolean previous) { StringBundler sb = null; if (orderByComparator != null) { sb = new StringBundler( 7 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { sb = new StringBundler(6); } if (getDB().isSupportsInlineDistinct()) { sb.append(_FILTER_SQL_SELECT_BOOKMARKSENTRY_WHERE); } else { sb.append( _FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_1); } sb.append(_FINDER_COLUMN_G_F_NOTS_GROUPID_2); sb.append(_FINDER_COLUMN_G_F_NOTS_FOLDERID_2); sb.append(_FINDER_COLUMN_G_F_NOTS_STATUS_2); if (!getDB().isSupportsInlineDistinct()) { sb.append( _FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { sb.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { if (getDB().isSupportsInlineDistinct()) { sb.append( getColumnName( _ORDER_BY_ENTITY_ALIAS, orderByConditionFields[i], true)); } else { sb.append( getColumnName( _ORDER_BY_ENTITY_TABLE, orderByConditionFields[i], true)); } if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { sb.append(WHERE_GREATER_THAN_HAS_NEXT); } else { sb.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { sb.append(WHERE_GREATER_THAN); } else { sb.append(WHERE_LESSER_THAN); } } } sb.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { if (getDB().isSupportsInlineDistinct()) { sb.append( getColumnName( _ORDER_BY_ENTITY_ALIAS, orderByFields[i], true)); } else { sb.append( getColumnName( _ORDER_BY_ENTITY_TABLE, orderByFields[i], true)); } if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { sb.append(ORDER_BY_ASC_HAS_NEXT); } else { sb.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { sb.append(ORDER_BY_ASC); } else { sb.append(ORDER_BY_DESC); } } } } else { if (getDB().isSupportsInlineDistinct()) { sb.append(BookmarksEntryModelImpl.ORDER_BY_SQL_INLINE_DISTINCT); } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck( sb.toString(), BookmarksEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); SQLQuery sqlQuery = session.createSynchronizedSQLQuery(sql); sqlQuery.setFirstResult(0); sqlQuery.setMaxResults(2); if (getDB().isSupportsInlineDistinct()) { sqlQuery.addEntity(_FILTER_ENTITY_ALIAS, BookmarksEntryImpl.class); } else { sqlQuery.addEntity(_FILTER_ENTITY_TABLE, BookmarksEntryImpl.class); } QueryPos queryPos = QueryPos.getInstance(sqlQuery); queryPos.add(groupId); queryPos.add(folderId); queryPos.add(status); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues( bookmarksEntry)) { queryPos.add(orderByConditionValue); } } List list = sqlQuery.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Returns all the bookmarks entries that the user has permission to view where groupId = ? and folderId = any ? and status ≠ ?. * * @param groupId the group ID * @param folderIds the folder IDs * @param status the status * @return the matching bookmarks entries that the user has permission to view */ @Override public List filterFindByG_F_NotS( long groupId, long[] folderIds, int status) { return filterFindByG_F_NotS( groupId, folderIds, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the bookmarks entries that the user has permission to view where groupId = ? and folderId = any ? and status ≠ ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param folderIds the folder IDs * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @return the range of matching bookmarks entries that the user has permission to view */ @Override public List filterFindByG_F_NotS( long groupId, long[] folderIds, int status, int start, int end) { return filterFindByG_F_NotS( groupId, folderIds, status, start, end, null); } /** * Returns an ordered range of all the bookmarks entries that the user has permission to view where groupId = ? and folderId = any ? and status ≠ ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param folderIds the folder IDs * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching bookmarks entries that the user has permission to view */ @Override public List filterFindByG_F_NotS( long groupId, long[] folderIds, int status, int start, int end, OrderByComparator orderByComparator) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByG_F_NotS( groupId, folderIds, status, start, end, orderByComparator); } if (folderIds == null) { folderIds = new long[0]; } else if (folderIds.length > 1) { folderIds = ArrayUtil.sortedUnique(folderIds); } StringBundler sb = new StringBundler(); if (getDB().isSupportsInlineDistinct()) { sb.append(_FILTER_SQL_SELECT_BOOKMARKSENTRY_WHERE); } else { sb.append( _FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_1); } sb.append(_FINDER_COLUMN_G_F_NOTS_GROUPID_2); if (folderIds.length > 0) { sb.append("("); sb.append(_FINDER_COLUMN_G_F_NOTS_FOLDERID_7); sb.append(StringUtil.merge(folderIds)); sb.append(")"); sb.append(")"); sb.append(WHERE_AND); } sb.append(_FINDER_COLUMN_G_F_NOTS_STATUS_2); sb.setStringAt( removeConjunction(sb.stringAt(sb.index() - 1)), sb.index() - 1); if (!getDB().isSupportsInlineDistinct()) { sb.append( _FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { if (getDB().isSupportsInlineDistinct()) { appendOrderByComparator( sb, _ORDER_BY_ENTITY_ALIAS, orderByComparator, true); } else { appendOrderByComparator( sb, _ORDER_BY_ENTITY_TABLE, orderByComparator, true); } } else { if (getDB().isSupportsInlineDistinct()) { sb.append(BookmarksEntryModelImpl.ORDER_BY_SQL_INLINE_DISTINCT); } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck( sb.toString(), BookmarksEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery sqlQuery = session.createSynchronizedSQLQuery(sql); if (getDB().isSupportsInlineDistinct()) { sqlQuery.addEntity( _FILTER_ENTITY_ALIAS, BookmarksEntryImpl.class); } else { sqlQuery.addEntity( _FILTER_ENTITY_TABLE, BookmarksEntryImpl.class); } QueryPos queryPos = QueryPos.getInstance(sqlQuery); queryPos.add(groupId); queryPos.add(status); return (List)QueryUtil.list( sqlQuery, getDialect(), start, end); } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } /** * Returns all the bookmarks entries where groupId = ? and folderId = any ? and status ≠ ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param folderIds the folder IDs * @param status the status * @return the matching bookmarks entries */ @Override public List findByG_F_NotS( long groupId, long[] folderIds, int status) { return findByG_F_NotS( groupId, folderIds, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the bookmarks entries where groupId = ? and folderId = any ? and status ≠ ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param folderIds the folder IDs * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @return the range of matching bookmarks entries */ @Override public List findByG_F_NotS( long groupId, long[] folderIds, int status, int start, int end) { return findByG_F_NotS(groupId, folderIds, status, start, end, null); } /** * Returns an ordered range of all the bookmarks entries where groupId = ? and folderId = any ? and status ≠ ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param folderIds the folder IDs * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching bookmarks entries */ @Override public List findByG_F_NotS( long groupId, long[] folderIds, int status, int start, int end, OrderByComparator orderByComparator) { return findByG_F_NotS( groupId, folderIds, status, start, end, orderByComparator, true); } /** * Returns an ordered range of all the bookmarks entries where groupId = ? and folderId = ? and status ≠ ?, optionally using the finder cache. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param folderIds the folder IDs * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @param useFinderCache whether to use the finder cache * @return the ordered range of matching bookmarks entries */ @Override public List findByG_F_NotS( long groupId, long[] folderIds, int status, int start, int end, OrderByComparator orderByComparator, boolean useFinderCache) { if (folderIds == null) { folderIds = new long[0]; } else if (folderIds.length > 1) { folderIds = ArrayUtil.sortedUnique(folderIds); } if (folderIds.length == 1) { return findByG_F_NotS( groupId, folderIds[0], status, start, end, orderByComparator); } try (SafeCloseable safeCloseable = ctPersistenceHelper.setCTCollectionIdWithSafeCloseable( BookmarksEntry.class)) { Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { if (useFinderCache) { finderArgs = new Object[] { groupId, StringUtil.merge(folderIds), status }; } } else if (useFinderCache) { finderArgs = new Object[] { groupId, StringUtil.merge(folderIds), status, start, end, orderByComparator }; } List list = null; if (useFinderCache) { list = (List)finderCache.getResult( _finderPathWithPaginationFindByG_F_NotS, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (BookmarksEntry bookmarksEntry : list) { if ((groupId != bookmarksEntry.getGroupId()) || !ArrayUtil.contains( folderIds, bookmarksEntry.getFolderId()) || (status == bookmarksEntry.getStatus())) { list = null; break; } } } } if (list == null) { StringBundler sb = new StringBundler(); sb.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_G_F_NOTS_GROUPID_2); if (folderIds.length > 0) { sb.append("("); sb.append(_FINDER_COLUMN_G_F_NOTS_FOLDERID_7); sb.append(StringUtil.merge(folderIds)); sb.append(")"); sb.append(")"); sb.append(WHERE_AND); } sb.append(_FINDER_COLUMN_G_F_NOTS_STATUS_2); sb.setStringAt( removeConjunction(sb.stringAt(sb.index() - 1)), sb.index() - 1); if (orderByComparator != null) { appendOrderByComparator( sb, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_JPQL); } String sql = sb.toString(); Session session = null; try { session = openSession(); Query query = session.createQuery(sql); QueryPos queryPos = QueryPos.getInstance(query); queryPos.add(groupId); queryPos.add(status); list = (List)QueryUtil.list( query, getDialect(), start, end); cacheResult(list); if (useFinderCache) { finderCache.putResult( _finderPathWithPaginationFindByG_F_NotS, finderArgs, list); } } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } return list; } } /** * Removes all the bookmarks entries where groupId = ? and folderId = ? and status ≠ ? from the database. * * @param groupId the group ID * @param folderId the folder ID * @param status the status */ @Override public void removeByG_F_NotS(long groupId, long folderId, int status) { for (BookmarksEntry bookmarksEntry : findByG_F_NotS( groupId, folderId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(bookmarksEntry); } } /** * Returns the number of bookmarks entries where groupId = ? and folderId = ? and status ≠ ?. * * @param groupId the group ID * @param folderId the folder ID * @param status the status * @return the number of matching bookmarks entries */ @Override public int countByG_F_NotS(long groupId, long folderId, int status) { try (SafeCloseable safeCloseable = ctPersistenceHelper.setCTCollectionIdWithSafeCloseable( BookmarksEntry.class)) { FinderPath finderPath = _finderPathWithPaginationCountByG_F_NotS; Object[] finderArgs = new Object[] {groupId, folderId, status}; Long count = (Long)finderCache.getResult( finderPath, finderArgs, this); if (count == null) { StringBundler sb = new StringBundler(4); sb.append(_SQL_COUNT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_G_F_NOTS_GROUPID_2); sb.append(_FINDER_COLUMN_G_F_NOTS_FOLDERID_2); sb.append(_FINDER_COLUMN_G_F_NOTS_STATUS_2); String sql = sb.toString(); Session session = null; try { session = openSession(); Query query = session.createQuery(sql); QueryPos queryPos = QueryPos.getInstance(query); queryPos.add(groupId); queryPos.add(folderId); queryPos.add(status); count = (Long)query.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } return count.intValue(); } } /** * Returns the number of bookmarks entries where groupId = ? and folderId = any ? and status ≠ ?. * * @param groupId the group ID * @param folderIds the folder IDs * @param status the status * @return the number of matching bookmarks entries */ @Override public int countByG_F_NotS(long groupId, long[] folderIds, int status) { if (folderIds == null) { folderIds = new long[0]; } else if (folderIds.length > 1) { folderIds = ArrayUtil.sortedUnique(folderIds); } try (SafeCloseable safeCloseable = ctPersistenceHelper.setCTCollectionIdWithSafeCloseable( BookmarksEntry.class)) { Object[] finderArgs = new Object[] { groupId, StringUtil.merge(folderIds), status }; Long count = (Long)finderCache.getResult( _finderPathWithPaginationCountByG_F_NotS, finderArgs, this); if (count == null) { StringBundler sb = new StringBundler(); sb.append(_SQL_COUNT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_G_F_NOTS_GROUPID_2); if (folderIds.length > 0) { sb.append("("); sb.append(_FINDER_COLUMN_G_F_NOTS_FOLDERID_7); sb.append(StringUtil.merge(folderIds)); sb.append(")"); sb.append(")"); sb.append(WHERE_AND); } sb.append(_FINDER_COLUMN_G_F_NOTS_STATUS_2); sb.setStringAt( removeConjunction(sb.stringAt(sb.index() - 1)), sb.index() - 1); String sql = sb.toString(); Session session = null; try { session = openSession(); Query query = session.createQuery(sql); QueryPos queryPos = QueryPos.getInstance(query); queryPos.add(groupId); queryPos.add(status); count = (Long)query.uniqueResult(); finderCache.putResult( _finderPathWithPaginationCountByG_F_NotS, finderArgs, count); } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } return count.intValue(); } } /** * Returns the number of bookmarks entries that the user has permission to view where groupId = ? and folderId = ? and status ≠ ?. * * @param groupId the group ID * @param folderId the folder ID * @param status the status * @return the number of matching bookmarks entries that the user has permission to view */ @Override public int filterCountByG_F_NotS(long groupId, long folderId, int status) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return countByG_F_NotS(groupId, folderId, status); } StringBundler sb = new StringBundler(4); sb.append(_FILTER_SQL_COUNT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_G_F_NOTS_GROUPID_2); sb.append(_FINDER_COLUMN_G_F_NOTS_FOLDERID_2); sb.append(_FINDER_COLUMN_G_F_NOTS_STATUS_2); String sql = InlineSQLHelperUtil.replacePermissionCheck( sb.toString(), BookmarksEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery sqlQuery = session.createSynchronizedSQLQuery(sql); sqlQuery.addScalar( COUNT_COLUMN_NAME, com.liferay.portal.kernel.dao.orm.Type.LONG); QueryPos queryPos = QueryPos.getInstance(sqlQuery); queryPos.add(groupId); queryPos.add(folderId); queryPos.add(status); Long count = (Long)sqlQuery.uniqueResult(); return count.intValue(); } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } /** * Returns the number of bookmarks entries that the user has permission to view where groupId = ? and folderId = any ? and status ≠ ?. * * @param groupId the group ID * @param folderIds the folder IDs * @param status the status * @return the number of matching bookmarks entries that the user has permission to view */ @Override public int filterCountByG_F_NotS( long groupId, long[] folderIds, int status) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return countByG_F_NotS(groupId, folderIds, status); } if (folderIds == null) { folderIds = new long[0]; } else if (folderIds.length > 1) { folderIds = ArrayUtil.sortedUnique(folderIds); } StringBundler sb = new StringBundler(); sb.append(_FILTER_SQL_COUNT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_G_F_NOTS_GROUPID_2); if (folderIds.length > 0) { sb.append("("); sb.append(_FINDER_COLUMN_G_F_NOTS_FOLDERID_7); sb.append(StringUtil.merge(folderIds)); sb.append(")"); sb.append(")"); sb.append(WHERE_AND); } sb.append(_FINDER_COLUMN_G_F_NOTS_STATUS_2); sb.setStringAt( removeConjunction(sb.stringAt(sb.index() - 1)), sb.index() - 1); String sql = InlineSQLHelperUtil.replacePermissionCheck( sb.toString(), BookmarksEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery sqlQuery = session.createSynchronizedSQLQuery(sql); sqlQuery.addScalar( COUNT_COLUMN_NAME, com.liferay.portal.kernel.dao.orm.Type.LONG); QueryPos queryPos = QueryPos.getInstance(sqlQuery); queryPos.add(groupId); queryPos.add(status); Long count = (Long)sqlQuery.uniqueResult(); return count.intValue(); } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } private static final String _FINDER_COLUMN_G_F_NOTS_GROUPID_2 = "bookmarksEntry.groupId = ? AND "; private static final String _FINDER_COLUMN_G_F_NOTS_FOLDERID_2 = "bookmarksEntry.folderId = ? AND "; private static final String _FINDER_COLUMN_G_F_NOTS_FOLDERID_7 = "bookmarksEntry.folderId IN ("; private static final String _FINDER_COLUMN_G_F_NOTS_STATUS_2 = "bookmarksEntry.status != ?"; private FinderPath _finderPathWithPaginationFindByG_U_F_S; private FinderPath _finderPathWithoutPaginationFindByG_U_F_S; private FinderPath _finderPathCountByG_U_F_S; private FinderPath _finderPathWithPaginationCountByG_U_F_S; /** * Returns all the bookmarks entries where groupId = ? and userId = ? and folderId = ? and status = ?. * * @param groupId the group ID * @param userId the user ID * @param folderId the folder ID * @param status the status * @return the matching bookmarks entries */ @Override public List findByG_U_F_S( long groupId, long userId, long folderId, int status) { return findByG_U_F_S( groupId, userId, folderId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the bookmarks entries where groupId = ? and userId = ? and folderId = ? and status = ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param userId the user ID * @param folderId the folder ID * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @return the range of matching bookmarks entries */ @Override public List findByG_U_F_S( long groupId, long userId, long folderId, int status, int start, int end) { return findByG_U_F_S( groupId, userId, folderId, status, start, end, null); } /** * Returns an ordered range of all the bookmarks entries where groupId = ? and userId = ? and folderId = ? and status = ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param userId the user ID * @param folderId the folder ID * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching bookmarks entries */ @Override public List findByG_U_F_S( long groupId, long userId, long folderId, int status, int start, int end, OrderByComparator orderByComparator) { return findByG_U_F_S( groupId, userId, folderId, status, start, end, orderByComparator, true); } /** * Returns an ordered range of all the bookmarks entries where groupId = ? and userId = ? and folderId = ? and status = ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param userId the user ID * @param folderId the folder ID * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @param useFinderCache whether to use the finder cache * @return the ordered range of matching bookmarks entries */ @Override public List findByG_U_F_S( long groupId, long userId, long folderId, int status, int start, int end, OrderByComparator orderByComparator, boolean useFinderCache) { try (SafeCloseable safeCloseable = ctPersistenceHelper.setCTCollectionIdWithSafeCloseable( BookmarksEntry.class)) { FinderPath finderPath = null; Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { if (useFinderCache) { finderPath = _finderPathWithoutPaginationFindByG_U_F_S; finderArgs = new Object[] { groupId, userId, folderId, status }; } } else if (useFinderCache) { finderPath = _finderPathWithPaginationFindByG_U_F_S; finderArgs = new Object[] { groupId, userId, folderId, status, start, end, orderByComparator }; } List list = null; if (useFinderCache) { list = (List)finderCache.getResult( finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (BookmarksEntry bookmarksEntry : list) { if ((groupId != bookmarksEntry.getGroupId()) || (userId != bookmarksEntry.getUserId()) || (folderId != bookmarksEntry.getFolderId()) || (status != bookmarksEntry.getStatus())) { list = null; break; } } } } if (list == null) { StringBundler sb = null; if (orderByComparator != null) { sb = new StringBundler( 6 + (orderByComparator.getOrderByFields().length * 2)); } else { sb = new StringBundler(6); } sb.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_G_U_F_S_GROUPID_2); sb.append(_FINDER_COLUMN_G_U_F_S_USERID_2); sb.append(_FINDER_COLUMN_G_U_F_S_FOLDERID_2); sb.append(_FINDER_COLUMN_G_U_F_S_STATUS_2); if (orderByComparator != null) { appendOrderByComparator( sb, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_JPQL); } String sql = sb.toString(); Session session = null; try { session = openSession(); Query query = session.createQuery(sql); QueryPos queryPos = QueryPos.getInstance(query); queryPos.add(groupId); queryPos.add(userId); queryPos.add(folderId); queryPos.add(status); list = (List)QueryUtil.list( query, getDialect(), start, end); cacheResult(list); if (useFinderCache) { finderCache.putResult(finderPath, finderArgs, list); } } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } return list; } } /** * Returns the first bookmarks entry in the ordered set where groupId = ? and userId = ? and folderId = ? and status = ?. * * @param groupId the group ID * @param userId the user ID * @param folderId the folder ID * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching bookmarks entry * @throws NoSuchEntryException if a matching bookmarks entry could not be found */ @Override public BookmarksEntry findByG_U_F_S_First( long groupId, long userId, long folderId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BookmarksEntry bookmarksEntry = fetchByG_U_F_S_First( groupId, userId, folderId, status, orderByComparator); if (bookmarksEntry != null) { return bookmarksEntry; } StringBundler sb = new StringBundler(10); sb.append(_NO_SUCH_ENTITY_WITH_KEY); sb.append("groupId="); sb.append(groupId); sb.append(", userId="); sb.append(userId); sb.append(", folderId="); sb.append(folderId); sb.append(", status="); sb.append(status); sb.append("}"); throw new NoSuchEntryException(sb.toString()); } /** * Returns the first bookmarks entry in the ordered set where groupId = ? and userId = ? and folderId = ? and status = ?. * * @param groupId the group ID * @param userId the user ID * @param folderId the folder ID * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching bookmarks entry, or null if a matching bookmarks entry could not be found */ @Override public BookmarksEntry fetchByG_U_F_S_First( long groupId, long userId, long folderId, int status, OrderByComparator orderByComparator) { List list = findByG_U_F_S( groupId, userId, folderId, status, 0, 1, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the last bookmarks entry in the ordered set where groupId = ? and userId = ? and folderId = ? and status = ?. * * @param groupId the group ID * @param userId the user ID * @param folderId the folder ID * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching bookmarks entry * @throws NoSuchEntryException if a matching bookmarks entry could not be found */ @Override public BookmarksEntry findByG_U_F_S_Last( long groupId, long userId, long folderId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BookmarksEntry bookmarksEntry = fetchByG_U_F_S_Last( groupId, userId, folderId, status, orderByComparator); if (bookmarksEntry != null) { return bookmarksEntry; } StringBundler sb = new StringBundler(10); sb.append(_NO_SUCH_ENTITY_WITH_KEY); sb.append("groupId="); sb.append(groupId); sb.append(", userId="); sb.append(userId); sb.append(", folderId="); sb.append(folderId); sb.append(", status="); sb.append(status); sb.append("}"); throw new NoSuchEntryException(sb.toString()); } /** * Returns the last bookmarks entry in the ordered set where groupId = ? and userId = ? and folderId = ? and status = ?. * * @param groupId the group ID * @param userId the user ID * @param folderId the folder ID * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching bookmarks entry, or null if a matching bookmarks entry could not be found */ @Override public BookmarksEntry fetchByG_U_F_S_Last( long groupId, long userId, long folderId, int status, OrderByComparator orderByComparator) { int count = countByG_U_F_S(groupId, userId, folderId, status); if (count == 0) { return null; } List list = findByG_U_F_S( groupId, userId, folderId, status, count - 1, count, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the bookmarks entries before and after the current bookmarks entry in the ordered set where groupId = ? and userId = ? and folderId = ? and status = ?. * * @param entryId the primary key of the current bookmarks entry * @param groupId the group ID * @param userId the user ID * @param folderId the folder ID * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the previous, current, and next bookmarks entry * @throws NoSuchEntryException if a bookmarks entry with the primary key could not be found */ @Override public BookmarksEntry[] findByG_U_F_S_PrevAndNext( long entryId, long groupId, long userId, long folderId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BookmarksEntry bookmarksEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BookmarksEntry[] array = new BookmarksEntryImpl[3]; array[0] = getByG_U_F_S_PrevAndNext( session, bookmarksEntry, groupId, userId, folderId, status, orderByComparator, true); array[1] = bookmarksEntry; array[2] = getByG_U_F_S_PrevAndNext( session, bookmarksEntry, groupId, userId, folderId, status, orderByComparator, false); return array; } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } protected BookmarksEntry getByG_U_F_S_PrevAndNext( Session session, BookmarksEntry bookmarksEntry, long groupId, long userId, long folderId, int status, OrderByComparator orderByComparator, boolean previous) { StringBundler sb = null; if (orderByComparator != null) { sb = new StringBundler( 7 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { sb = new StringBundler(6); } sb.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_G_U_F_S_GROUPID_2); sb.append(_FINDER_COLUMN_G_U_F_S_USERID_2); sb.append(_FINDER_COLUMN_G_U_F_S_FOLDERID_2); sb.append(_FINDER_COLUMN_G_U_F_S_STATUS_2); if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { sb.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { sb.append(_ORDER_BY_ENTITY_ALIAS); sb.append(orderByConditionFields[i]); if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { sb.append(WHERE_GREATER_THAN_HAS_NEXT); } else { sb.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { sb.append(WHERE_GREATER_THAN); } else { sb.append(WHERE_LESSER_THAN); } } } sb.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { sb.append(_ORDER_BY_ENTITY_ALIAS); sb.append(orderByFields[i]); if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { sb.append(ORDER_BY_ASC_HAS_NEXT); } else { sb.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { sb.append(ORDER_BY_ASC); } else { sb.append(ORDER_BY_DESC); } } } } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_JPQL); } String sql = sb.toString(); Query query = session.createQuery(sql); query.setFirstResult(0); query.setMaxResults(2); QueryPos queryPos = QueryPos.getInstance(query); queryPos.add(groupId); queryPos.add(userId); queryPos.add(folderId); queryPos.add(status); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues( bookmarksEntry)) { queryPos.add(orderByConditionValue); } } List list = query.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Returns all the bookmarks entries that the user has permission to view where groupId = ? and userId = ? and folderId = ? and status = ?. * * @param groupId the group ID * @param userId the user ID * @param folderId the folder ID * @param status the status * @return the matching bookmarks entries that the user has permission to view */ @Override public List filterFindByG_U_F_S( long groupId, long userId, long folderId, int status) { return filterFindByG_U_F_S( groupId, userId, folderId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the bookmarks entries that the user has permission to view where groupId = ? and userId = ? and folderId = ? and status = ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param userId the user ID * @param folderId the folder ID * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @return the range of matching bookmarks entries that the user has permission to view */ @Override public List filterFindByG_U_F_S( long groupId, long userId, long folderId, int status, int start, int end) { return filterFindByG_U_F_S( groupId, userId, folderId, status, start, end, null); } /** * Returns an ordered range of all the bookmarks entries that the user has permissions to view where groupId = ? and userId = ? and folderId = ? and status = ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param userId the user ID * @param folderId the folder ID * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching bookmarks entries that the user has permission to view */ @Override public List filterFindByG_U_F_S( long groupId, long userId, long folderId, int status, int start, int end, OrderByComparator orderByComparator) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByG_U_F_S( groupId, userId, folderId, status, start, end, orderByComparator); } StringBundler sb = null; if (orderByComparator != null) { sb = new StringBundler( 6 + (orderByComparator.getOrderByFields().length * 2)); } else { sb = new StringBundler(7); } if (getDB().isSupportsInlineDistinct()) { sb.append(_FILTER_SQL_SELECT_BOOKMARKSENTRY_WHERE); } else { sb.append( _FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_1); } sb.append(_FINDER_COLUMN_G_U_F_S_GROUPID_2); sb.append(_FINDER_COLUMN_G_U_F_S_USERID_2); sb.append(_FINDER_COLUMN_G_U_F_S_FOLDERID_2); sb.append(_FINDER_COLUMN_G_U_F_S_STATUS_2); if (!getDB().isSupportsInlineDistinct()) { sb.append( _FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { if (getDB().isSupportsInlineDistinct()) { appendOrderByComparator( sb, _ORDER_BY_ENTITY_ALIAS, orderByComparator, true); } else { appendOrderByComparator( sb, _ORDER_BY_ENTITY_TABLE, orderByComparator, true); } } else { if (getDB().isSupportsInlineDistinct()) { sb.append(BookmarksEntryModelImpl.ORDER_BY_SQL_INLINE_DISTINCT); } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck( sb.toString(), BookmarksEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery sqlQuery = session.createSynchronizedSQLQuery(sql); if (getDB().isSupportsInlineDistinct()) { sqlQuery.addEntity( _FILTER_ENTITY_ALIAS, BookmarksEntryImpl.class); } else { sqlQuery.addEntity( _FILTER_ENTITY_TABLE, BookmarksEntryImpl.class); } QueryPos queryPos = QueryPos.getInstance(sqlQuery); queryPos.add(groupId); queryPos.add(userId); queryPos.add(folderId); queryPos.add(status); return (List)QueryUtil.list( sqlQuery, getDialect(), start, end); } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } /** * Returns the bookmarks entries before and after the current bookmarks entry in the ordered set of bookmarks entries that the user has permission to view where groupId = ? and userId = ? and folderId = ? and status = ?. * * @param entryId the primary key of the current bookmarks entry * @param groupId the group ID * @param userId the user ID * @param folderId the folder ID * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the previous, current, and next bookmarks entry * @throws NoSuchEntryException if a bookmarks entry with the primary key could not be found */ @Override public BookmarksEntry[] filterFindByG_U_F_S_PrevAndNext( long entryId, long groupId, long userId, long folderId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByG_U_F_S_PrevAndNext( entryId, groupId, userId, folderId, status, orderByComparator); } BookmarksEntry bookmarksEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BookmarksEntry[] array = new BookmarksEntryImpl[3]; array[0] = filterGetByG_U_F_S_PrevAndNext( session, bookmarksEntry, groupId, userId, folderId, status, orderByComparator, true); array[1] = bookmarksEntry; array[2] = filterGetByG_U_F_S_PrevAndNext( session, bookmarksEntry, groupId, userId, folderId, status, orderByComparator, false); return array; } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } protected BookmarksEntry filterGetByG_U_F_S_PrevAndNext( Session session, BookmarksEntry bookmarksEntry, long groupId, long userId, long folderId, int status, OrderByComparator orderByComparator, boolean previous) { StringBundler sb = null; if (orderByComparator != null) { sb = new StringBundler( 8 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { sb = new StringBundler(7); } if (getDB().isSupportsInlineDistinct()) { sb.append(_FILTER_SQL_SELECT_BOOKMARKSENTRY_WHERE); } else { sb.append( _FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_1); } sb.append(_FINDER_COLUMN_G_U_F_S_GROUPID_2); sb.append(_FINDER_COLUMN_G_U_F_S_USERID_2); sb.append(_FINDER_COLUMN_G_U_F_S_FOLDERID_2); sb.append(_FINDER_COLUMN_G_U_F_S_STATUS_2); if (!getDB().isSupportsInlineDistinct()) { sb.append( _FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { sb.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { if (getDB().isSupportsInlineDistinct()) { sb.append( getColumnName( _ORDER_BY_ENTITY_ALIAS, orderByConditionFields[i], true)); } else { sb.append( getColumnName( _ORDER_BY_ENTITY_TABLE, orderByConditionFields[i], true)); } if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { sb.append(WHERE_GREATER_THAN_HAS_NEXT); } else { sb.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { sb.append(WHERE_GREATER_THAN); } else { sb.append(WHERE_LESSER_THAN); } } } sb.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { if (getDB().isSupportsInlineDistinct()) { sb.append( getColumnName( _ORDER_BY_ENTITY_ALIAS, orderByFields[i], true)); } else { sb.append( getColumnName( _ORDER_BY_ENTITY_TABLE, orderByFields[i], true)); } if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { sb.append(ORDER_BY_ASC_HAS_NEXT); } else { sb.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { sb.append(ORDER_BY_ASC); } else { sb.append(ORDER_BY_DESC); } } } } else { if (getDB().isSupportsInlineDistinct()) { sb.append(BookmarksEntryModelImpl.ORDER_BY_SQL_INLINE_DISTINCT); } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck( sb.toString(), BookmarksEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); SQLQuery sqlQuery = session.createSynchronizedSQLQuery(sql); sqlQuery.setFirstResult(0); sqlQuery.setMaxResults(2); if (getDB().isSupportsInlineDistinct()) { sqlQuery.addEntity(_FILTER_ENTITY_ALIAS, BookmarksEntryImpl.class); } else { sqlQuery.addEntity(_FILTER_ENTITY_TABLE, BookmarksEntryImpl.class); } QueryPos queryPos = QueryPos.getInstance(sqlQuery); queryPos.add(groupId); queryPos.add(userId); queryPos.add(folderId); queryPos.add(status); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues( bookmarksEntry)) { queryPos.add(orderByConditionValue); } } List list = sqlQuery.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Returns all the bookmarks entries that the user has permission to view where groupId = ? and userId = ? and folderId = any ? and status = ?. * * @param groupId the group ID * @param userId the user ID * @param folderIds the folder IDs * @param status the status * @return the matching bookmarks entries that the user has permission to view */ @Override public List filterFindByG_U_F_S( long groupId, long userId, long[] folderIds, int status) { return filterFindByG_U_F_S( groupId, userId, folderIds, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the bookmarks entries that the user has permission to view where groupId = ? and userId = ? and folderId = any ? and status = ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param userId the user ID * @param folderIds the folder IDs * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @return the range of matching bookmarks entries that the user has permission to view */ @Override public List filterFindByG_U_F_S( long groupId, long userId, long[] folderIds, int status, int start, int end) { return filterFindByG_U_F_S( groupId, userId, folderIds, status, start, end, null); } /** * Returns an ordered range of all the bookmarks entries that the user has permission to view where groupId = ? and userId = ? and folderId = any ? and status = ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param userId the user ID * @param folderIds the folder IDs * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching bookmarks entries that the user has permission to view */ @Override public List filterFindByG_U_F_S( long groupId, long userId, long[] folderIds, int status, int start, int end, OrderByComparator orderByComparator) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByG_U_F_S( groupId, userId, folderIds, status, start, end, orderByComparator); } if (folderIds == null) { folderIds = new long[0]; } else if (folderIds.length > 1) { folderIds = ArrayUtil.sortedUnique(folderIds); } StringBundler sb = new StringBundler(); if (getDB().isSupportsInlineDistinct()) { sb.append(_FILTER_SQL_SELECT_BOOKMARKSENTRY_WHERE); } else { sb.append( _FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_1); } sb.append(_FINDER_COLUMN_G_U_F_S_GROUPID_2); sb.append(_FINDER_COLUMN_G_U_F_S_USERID_2); if (folderIds.length > 0) { sb.append("("); sb.append(_FINDER_COLUMN_G_U_F_S_FOLDERID_7); sb.append(StringUtil.merge(folderIds)); sb.append(")"); sb.append(")"); sb.append(WHERE_AND); } sb.append(_FINDER_COLUMN_G_U_F_S_STATUS_2); sb.setStringAt( removeConjunction(sb.stringAt(sb.index() - 1)), sb.index() - 1); if (!getDB().isSupportsInlineDistinct()) { sb.append( _FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { if (getDB().isSupportsInlineDistinct()) { appendOrderByComparator( sb, _ORDER_BY_ENTITY_ALIAS, orderByComparator, true); } else { appendOrderByComparator( sb, _ORDER_BY_ENTITY_TABLE, orderByComparator, true); } } else { if (getDB().isSupportsInlineDistinct()) { sb.append(BookmarksEntryModelImpl.ORDER_BY_SQL_INLINE_DISTINCT); } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck( sb.toString(), BookmarksEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery sqlQuery = session.createSynchronizedSQLQuery(sql); if (getDB().isSupportsInlineDistinct()) { sqlQuery.addEntity( _FILTER_ENTITY_ALIAS, BookmarksEntryImpl.class); } else { sqlQuery.addEntity( _FILTER_ENTITY_TABLE, BookmarksEntryImpl.class); } QueryPos queryPos = QueryPos.getInstance(sqlQuery); queryPos.add(groupId); queryPos.add(userId); queryPos.add(status); return (List)QueryUtil.list( sqlQuery, getDialect(), start, end); } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } /** * Returns all the bookmarks entries where groupId = ? and userId = ? and folderId = any ? and status = ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param userId the user ID * @param folderIds the folder IDs * @param status the status * @return the matching bookmarks entries */ @Override public List findByG_U_F_S( long groupId, long userId, long[] folderIds, int status) { return findByG_U_F_S( groupId, userId, folderIds, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the bookmarks entries where groupId = ? and userId = ? and folderId = any ? and status = ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param userId the user ID * @param folderIds the folder IDs * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @return the range of matching bookmarks entries */ @Override public List findByG_U_F_S( long groupId, long userId, long[] folderIds, int status, int start, int end) { return findByG_U_F_S( groupId, userId, folderIds, status, start, end, null); } /** * Returns an ordered range of all the bookmarks entries where groupId = ? and userId = ? and folderId = any ? and status = ?. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param userId the user ID * @param folderIds the folder IDs * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching bookmarks entries */ @Override public List findByG_U_F_S( long groupId, long userId, long[] folderIds, int status, int start, int end, OrderByComparator orderByComparator) { return findByG_U_F_S( groupId, userId, folderIds, status, start, end, orderByComparator, true); } /** * Returns an ordered range of all the bookmarks entries where groupId = ? and userId = ? and folderId = ? and status = ?, optionally using the finder cache. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param groupId the group ID * @param userId the user ID * @param folderIds the folder IDs * @param status the status * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @param useFinderCache whether to use the finder cache * @return the ordered range of matching bookmarks entries */ @Override public List findByG_U_F_S( long groupId, long userId, long[] folderIds, int status, int start, int end, OrderByComparator orderByComparator, boolean useFinderCache) { if (folderIds == null) { folderIds = new long[0]; } else if (folderIds.length > 1) { folderIds = ArrayUtil.sortedUnique(folderIds); } if (folderIds.length == 1) { return findByG_U_F_S( groupId, userId, folderIds[0], status, start, end, orderByComparator); } try (SafeCloseable safeCloseable = ctPersistenceHelper.setCTCollectionIdWithSafeCloseable( BookmarksEntry.class)) { Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { if (useFinderCache) { finderArgs = new Object[] { groupId, userId, StringUtil.merge(folderIds), status }; } } else if (useFinderCache) { finderArgs = new Object[] { groupId, userId, StringUtil.merge(folderIds), status, start, end, orderByComparator }; } List list = null; if (useFinderCache) { list = (List)finderCache.getResult( _finderPathWithPaginationFindByG_U_F_S, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (BookmarksEntry bookmarksEntry : list) { if ((groupId != bookmarksEntry.getGroupId()) || (userId != bookmarksEntry.getUserId()) || !ArrayUtil.contains( folderIds, bookmarksEntry.getFolderId()) || (status != bookmarksEntry.getStatus())) { list = null; break; } } } } if (list == null) { StringBundler sb = new StringBundler(); sb.append(_SQL_SELECT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_G_U_F_S_GROUPID_2); sb.append(_FINDER_COLUMN_G_U_F_S_USERID_2); if (folderIds.length > 0) { sb.append("("); sb.append(_FINDER_COLUMN_G_U_F_S_FOLDERID_7); sb.append(StringUtil.merge(folderIds)); sb.append(")"); sb.append(")"); sb.append(WHERE_AND); } sb.append(_FINDER_COLUMN_G_U_F_S_STATUS_2); sb.setStringAt( removeConjunction(sb.stringAt(sb.index() - 1)), sb.index() - 1); if (orderByComparator != null) { appendOrderByComparator( sb, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else { sb.append(BookmarksEntryModelImpl.ORDER_BY_JPQL); } String sql = sb.toString(); Session session = null; try { session = openSession(); Query query = session.createQuery(sql); QueryPos queryPos = QueryPos.getInstance(query); queryPos.add(groupId); queryPos.add(userId); queryPos.add(status); list = (List)QueryUtil.list( query, getDialect(), start, end); cacheResult(list); if (useFinderCache) { finderCache.putResult( _finderPathWithPaginationFindByG_U_F_S, finderArgs, list); } } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } return list; } } /** * Removes all the bookmarks entries where groupId = ? and userId = ? and folderId = ? and status = ? from the database. * * @param groupId the group ID * @param userId the user ID * @param folderId the folder ID * @param status the status */ @Override public void removeByG_U_F_S( long groupId, long userId, long folderId, int status) { for (BookmarksEntry bookmarksEntry : findByG_U_F_S( groupId, userId, folderId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(bookmarksEntry); } } /** * Returns the number of bookmarks entries where groupId = ? and userId = ? and folderId = ? and status = ?. * * @param groupId the group ID * @param userId the user ID * @param folderId the folder ID * @param status the status * @return the number of matching bookmarks entries */ @Override public int countByG_U_F_S( long groupId, long userId, long folderId, int status) { try (SafeCloseable safeCloseable = ctPersistenceHelper.setCTCollectionIdWithSafeCloseable( BookmarksEntry.class)) { FinderPath finderPath = _finderPathCountByG_U_F_S; Object[] finderArgs = new Object[] { groupId, userId, folderId, status }; Long count = (Long)finderCache.getResult( finderPath, finderArgs, this); if (count == null) { StringBundler sb = new StringBundler(5); sb.append(_SQL_COUNT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_G_U_F_S_GROUPID_2); sb.append(_FINDER_COLUMN_G_U_F_S_USERID_2); sb.append(_FINDER_COLUMN_G_U_F_S_FOLDERID_2); sb.append(_FINDER_COLUMN_G_U_F_S_STATUS_2); String sql = sb.toString(); Session session = null; try { session = openSession(); Query query = session.createQuery(sql); QueryPos queryPos = QueryPos.getInstance(query); queryPos.add(groupId); queryPos.add(userId); queryPos.add(folderId); queryPos.add(status); count = (Long)query.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } return count.intValue(); } } /** * Returns the number of bookmarks entries where groupId = ? and userId = ? and folderId = any ? and status = ?. * * @param groupId the group ID * @param userId the user ID * @param folderIds the folder IDs * @param status the status * @return the number of matching bookmarks entries */ @Override public int countByG_U_F_S( long groupId, long userId, long[] folderIds, int status) { if (folderIds == null) { folderIds = new long[0]; } else if (folderIds.length > 1) { folderIds = ArrayUtil.sortedUnique(folderIds); } try (SafeCloseable safeCloseable = ctPersistenceHelper.setCTCollectionIdWithSafeCloseable( BookmarksEntry.class)) { Object[] finderArgs = new Object[] { groupId, userId, StringUtil.merge(folderIds), status }; Long count = (Long)finderCache.getResult( _finderPathWithPaginationCountByG_U_F_S, finderArgs, this); if (count == null) { StringBundler sb = new StringBundler(); sb.append(_SQL_COUNT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_G_U_F_S_GROUPID_2); sb.append(_FINDER_COLUMN_G_U_F_S_USERID_2); if (folderIds.length > 0) { sb.append("("); sb.append(_FINDER_COLUMN_G_U_F_S_FOLDERID_7); sb.append(StringUtil.merge(folderIds)); sb.append(")"); sb.append(")"); sb.append(WHERE_AND); } sb.append(_FINDER_COLUMN_G_U_F_S_STATUS_2); sb.setStringAt( removeConjunction(sb.stringAt(sb.index() - 1)), sb.index() - 1); String sql = sb.toString(); Session session = null; try { session = openSession(); Query query = session.createQuery(sql); QueryPos queryPos = QueryPos.getInstance(query); queryPos.add(groupId); queryPos.add(userId); queryPos.add(status); count = (Long)query.uniqueResult(); finderCache.putResult( _finderPathWithPaginationCountByG_U_F_S, finderArgs, count); } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } return count.intValue(); } } /** * Returns the number of bookmarks entries that the user has permission to view where groupId = ? and userId = ? and folderId = ? and status = ?. * * @param groupId the group ID * @param userId the user ID * @param folderId the folder ID * @param status the status * @return the number of matching bookmarks entries that the user has permission to view */ @Override public int filterCountByG_U_F_S( long groupId, long userId, long folderId, int status) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return countByG_U_F_S(groupId, userId, folderId, status); } StringBundler sb = new StringBundler(5); sb.append(_FILTER_SQL_COUNT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_G_U_F_S_GROUPID_2); sb.append(_FINDER_COLUMN_G_U_F_S_USERID_2); sb.append(_FINDER_COLUMN_G_U_F_S_FOLDERID_2); sb.append(_FINDER_COLUMN_G_U_F_S_STATUS_2); String sql = InlineSQLHelperUtil.replacePermissionCheck( sb.toString(), BookmarksEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery sqlQuery = session.createSynchronizedSQLQuery(sql); sqlQuery.addScalar( COUNT_COLUMN_NAME, com.liferay.portal.kernel.dao.orm.Type.LONG); QueryPos queryPos = QueryPos.getInstance(sqlQuery); queryPos.add(groupId); queryPos.add(userId); queryPos.add(folderId); queryPos.add(status); Long count = (Long)sqlQuery.uniqueResult(); return count.intValue(); } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } /** * Returns the number of bookmarks entries that the user has permission to view where groupId = ? and userId = ? and folderId = any ? and status = ?. * * @param groupId the group ID * @param userId the user ID * @param folderIds the folder IDs * @param status the status * @return the number of matching bookmarks entries that the user has permission to view */ @Override public int filterCountByG_U_F_S( long groupId, long userId, long[] folderIds, int status) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return countByG_U_F_S(groupId, userId, folderIds, status); } if (folderIds == null) { folderIds = new long[0]; } else if (folderIds.length > 1) { folderIds = ArrayUtil.sortedUnique(folderIds); } StringBundler sb = new StringBundler(); sb.append(_FILTER_SQL_COUNT_BOOKMARKSENTRY_WHERE); sb.append(_FINDER_COLUMN_G_U_F_S_GROUPID_2); sb.append(_FINDER_COLUMN_G_U_F_S_USERID_2); if (folderIds.length > 0) { sb.append("("); sb.append(_FINDER_COLUMN_G_U_F_S_FOLDERID_7); sb.append(StringUtil.merge(folderIds)); sb.append(")"); sb.append(")"); sb.append(WHERE_AND); } sb.append(_FINDER_COLUMN_G_U_F_S_STATUS_2); sb.setStringAt( removeConjunction(sb.stringAt(sb.index() - 1)), sb.index() - 1); String sql = InlineSQLHelperUtil.replacePermissionCheck( sb.toString(), BookmarksEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery sqlQuery = session.createSynchronizedSQLQuery(sql); sqlQuery.addScalar( COUNT_COLUMN_NAME, com.liferay.portal.kernel.dao.orm.Type.LONG); QueryPos queryPos = QueryPos.getInstance(sqlQuery); queryPos.add(groupId); queryPos.add(userId); queryPos.add(status); Long count = (Long)sqlQuery.uniqueResult(); return count.intValue(); } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } private static final String _FINDER_COLUMN_G_U_F_S_GROUPID_2 = "bookmarksEntry.groupId = ? AND "; private static final String _FINDER_COLUMN_G_U_F_S_USERID_2 = "bookmarksEntry.userId = ? AND "; private static final String _FINDER_COLUMN_G_U_F_S_FOLDERID_2 = "bookmarksEntry.folderId = ? AND "; private static final String _FINDER_COLUMN_G_U_F_S_FOLDERID_7 = "bookmarksEntry.folderId IN ("; private static final String _FINDER_COLUMN_G_U_F_S_STATUS_2 = "bookmarksEntry.status = ?"; public BookmarksEntryPersistenceImpl() { Map dbColumnNames = new HashMap(); dbColumnNames.put("uuid", "uuid_"); setDBColumnNames(dbColumnNames); setModelClass(BookmarksEntry.class); setModelImplClass(BookmarksEntryImpl.class); setModelPKClass(long.class); setTable(BookmarksEntryTable.INSTANCE); } /** * Caches the bookmarks entry in the entity cache if it is enabled. * * @param bookmarksEntry the bookmarks entry */ @Override public void cacheResult(BookmarksEntry bookmarksEntry) { try (SafeCloseable safeCloseable = CTCollectionThreadLocal.setCTCollectionIdWithSafeCloseable( bookmarksEntry.getCtCollectionId())) { entityCache.putResult( BookmarksEntryImpl.class, bookmarksEntry.getPrimaryKey(), bookmarksEntry); finderCache.putResult( _finderPathFetchByUUID_G, new Object[] { bookmarksEntry.getUuid(), bookmarksEntry.getGroupId() }, bookmarksEntry); } } private int _valueObjectFinderCacheListThreshold; /** * Caches the bookmarks entries in the entity cache if it is enabled. * * @param bookmarksEntries the bookmarks entries */ @Override public void cacheResult(List bookmarksEntries) { if ((_valueObjectFinderCacheListThreshold == 0) || ((_valueObjectFinderCacheListThreshold > 0) && (bookmarksEntries.size() > _valueObjectFinderCacheListThreshold))) { return; } for (BookmarksEntry bookmarksEntry : bookmarksEntries) { try (SafeCloseable safeCloseable = CTCollectionThreadLocal.setCTCollectionIdWithSafeCloseable( bookmarksEntry.getCtCollectionId())) { if (entityCache.getResult( BookmarksEntryImpl.class, bookmarksEntry.getPrimaryKey()) == null) { cacheResult(bookmarksEntry); } } } } /** * Clears the cache for all bookmarks entries. * *

* The EntityCache and FinderCache are both cleared by this method. *

*/ @Override public void clearCache() { entityCache.clearCache(BookmarksEntryImpl.class); finderCache.clearCache(BookmarksEntryImpl.class); } /** * Clears the cache for the bookmarks entry. * *

* The EntityCache and FinderCache are both cleared by this method. *

*/ @Override public void clearCache(BookmarksEntry bookmarksEntry) { entityCache.removeResult(BookmarksEntryImpl.class, bookmarksEntry); } @Override public void clearCache(List bookmarksEntries) { for (BookmarksEntry bookmarksEntry : bookmarksEntries) { entityCache.removeResult(BookmarksEntryImpl.class, bookmarksEntry); } } @Override public void clearCache(Set primaryKeys) { finderCache.clearCache(BookmarksEntryImpl.class); for (Serializable primaryKey : primaryKeys) { entityCache.removeResult(BookmarksEntryImpl.class, primaryKey); } } protected void cacheUniqueFindersCache( BookmarksEntryModelImpl bookmarksEntryModelImpl) { try (SafeCloseable safeCloseable = CTCollectionThreadLocal.setCTCollectionIdWithSafeCloseable( bookmarksEntryModelImpl.getCtCollectionId())) { Object[] args = new Object[] { bookmarksEntryModelImpl.getUuid(), bookmarksEntryModelImpl.getGroupId() }; finderCache.putResult( _finderPathCountByUUID_G, args, Long.valueOf(1)); finderCache.putResult( _finderPathFetchByUUID_G, args, bookmarksEntryModelImpl); } } /** * Creates a new bookmarks entry with the primary key. Does not add the bookmarks entry to the database. * * @param entryId the primary key for the new bookmarks entry * @return the new bookmarks entry */ @Override public BookmarksEntry create(long entryId) { BookmarksEntry bookmarksEntry = new BookmarksEntryImpl(); bookmarksEntry.setNew(true); bookmarksEntry.setPrimaryKey(entryId); String uuid = PortalUUIDUtil.generate(); bookmarksEntry.setUuid(uuid); bookmarksEntry.setCompanyId(CompanyThreadLocal.getCompanyId()); return bookmarksEntry; } /** * Removes the bookmarks entry with the primary key from the database. Also notifies the appropriate model listeners. * * @param entryId the primary key of the bookmarks entry * @return the bookmarks entry that was removed * @throws NoSuchEntryException if a bookmarks entry with the primary key could not be found */ @Override public BookmarksEntry remove(long entryId) throws NoSuchEntryException { return remove((Serializable)entryId); } /** * Removes the bookmarks entry with the primary key from the database. Also notifies the appropriate model listeners. * * @param primaryKey the primary key of the bookmarks entry * @return the bookmarks entry that was removed * @throws NoSuchEntryException if a bookmarks entry with the primary key could not be found */ @Override public BookmarksEntry remove(Serializable primaryKey) throws NoSuchEntryException { Session session = null; try { session = openSession(); BookmarksEntry bookmarksEntry = (BookmarksEntry)session.get( BookmarksEntryImpl.class, primaryKey); if (bookmarksEntry == null) { if (_log.isDebugEnabled()) { _log.debug(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); } throw new NoSuchEntryException( _NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); } return remove(bookmarksEntry); } catch (NoSuchEntryException noSuchEntityException) { throw noSuchEntityException; } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } @Override protected BookmarksEntry removeImpl(BookmarksEntry bookmarksEntry) { Session session = null; try { session = openSession(); if (!session.contains(bookmarksEntry)) { bookmarksEntry = (BookmarksEntry)session.get( BookmarksEntryImpl.class, bookmarksEntry.getPrimaryKeyObj()); } if ((bookmarksEntry != null) && ctPersistenceHelper.isRemove(bookmarksEntry)) { session.delete(bookmarksEntry); } } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } if (bookmarksEntry != null) { clearCache(bookmarksEntry); } return bookmarksEntry; } @Override public BookmarksEntry updateImpl(BookmarksEntry bookmarksEntry) { boolean isNew = bookmarksEntry.isNew(); if (!(bookmarksEntry instanceof BookmarksEntryModelImpl)) { InvocationHandler invocationHandler = null; if (ProxyUtil.isProxyClass(bookmarksEntry.getClass())) { invocationHandler = ProxyUtil.getInvocationHandler( bookmarksEntry); throw new IllegalArgumentException( "Implement ModelWrapper in bookmarksEntry proxy " + invocationHandler.getClass()); } throw new IllegalArgumentException( "Implement ModelWrapper in custom BookmarksEntry implementation " + bookmarksEntry.getClass()); } BookmarksEntryModelImpl bookmarksEntryModelImpl = (BookmarksEntryModelImpl)bookmarksEntry; if (Validator.isNull(bookmarksEntry.getUuid())) { String uuid = PortalUUIDUtil.generate(); bookmarksEntry.setUuid(uuid); } ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext(); Date date = new Date(); if (isNew && (bookmarksEntry.getCreateDate() == null)) { if (serviceContext == null) { bookmarksEntry.setCreateDate(date); } else { bookmarksEntry.setCreateDate( serviceContext.getCreateDate(date)); } } if (!bookmarksEntryModelImpl.hasSetModifiedDate()) { if (serviceContext == null) { bookmarksEntry.setModifiedDate(date); } else { bookmarksEntry.setModifiedDate( serviceContext.getModifiedDate(date)); } } Session session = null; try { session = openSession(); if (ctPersistenceHelper.isInsert(bookmarksEntry)) { if (!isNew) { session.evict( BookmarksEntryImpl.class, bookmarksEntry.getPrimaryKeyObj()); } session.save(bookmarksEntry); } else { bookmarksEntry = (BookmarksEntry)session.merge(bookmarksEntry); } } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } entityCache.putResult( BookmarksEntryImpl.class, bookmarksEntryModelImpl, false, true); cacheUniqueFindersCache(bookmarksEntryModelImpl); if (isNew) { bookmarksEntry.setNew(false); } bookmarksEntry.resetOriginalValues(); return bookmarksEntry; } /** * Returns the bookmarks entry with the primary key or throws a com.liferay.portal.kernel.exception.NoSuchModelException if it could not be found. * * @param primaryKey the primary key of the bookmarks entry * @return the bookmarks entry * @throws NoSuchEntryException if a bookmarks entry with the primary key could not be found */ @Override public BookmarksEntry findByPrimaryKey(Serializable primaryKey) throws NoSuchEntryException { BookmarksEntry bookmarksEntry = fetchByPrimaryKey(primaryKey); if (bookmarksEntry == null) { if (_log.isDebugEnabled()) { _log.debug(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); } throw new NoSuchEntryException( _NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); } return bookmarksEntry; } /** * Returns the bookmarks entry with the primary key or throws a NoSuchEntryException if it could not be found. * * @param entryId the primary key of the bookmarks entry * @return the bookmarks entry * @throws NoSuchEntryException if a bookmarks entry with the primary key could not be found */ @Override public BookmarksEntry findByPrimaryKey(long entryId) throws NoSuchEntryException { return findByPrimaryKey((Serializable)entryId); } /** * Returns the bookmarks entry with the primary key or returns null if it could not be found. * * @param primaryKey the primary key of the bookmarks entry * @return the bookmarks entry, or null if a bookmarks entry with the primary key could not be found */ @Override public BookmarksEntry fetchByPrimaryKey(Serializable primaryKey) { if (ctPersistenceHelper.isProductionMode( BookmarksEntry.class, primaryKey)) { try (SafeCloseable safeCloseable = CTCollectionThreadLocal. setProductionModeWithSafeCloseable()) { return super.fetchByPrimaryKey(primaryKey); } } BookmarksEntry bookmarksEntry = (BookmarksEntry)entityCache.getResult( BookmarksEntryImpl.class, primaryKey); if (bookmarksEntry != null) { return bookmarksEntry; } Session session = null; try { session = openSession(); bookmarksEntry = (BookmarksEntry)session.get( BookmarksEntryImpl.class, primaryKey); if (bookmarksEntry != null) { cacheResult(bookmarksEntry); } } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } return bookmarksEntry; } /** * Returns the bookmarks entry with the primary key or returns null if it could not be found. * * @param entryId the primary key of the bookmarks entry * @return the bookmarks entry, or null if a bookmarks entry with the primary key could not be found */ @Override public BookmarksEntry fetchByPrimaryKey(long entryId) { return fetchByPrimaryKey((Serializable)entryId); } @Override public Map fetchByPrimaryKeys( Set primaryKeys) { if (ctPersistenceHelper.isProductionMode(BookmarksEntry.class)) { try (SafeCloseable safeCloseable = CTCollectionThreadLocal. setProductionModeWithSafeCloseable()) { return super.fetchByPrimaryKeys(primaryKeys); } } if (primaryKeys.isEmpty()) { return Collections.emptyMap(); } Map map = new HashMap(); if (primaryKeys.size() == 1) { Iterator iterator = primaryKeys.iterator(); Serializable primaryKey = iterator.next(); BookmarksEntry bookmarksEntry = fetchByPrimaryKey(primaryKey); if (bookmarksEntry != null) { map.put(primaryKey, bookmarksEntry); } return map; } Set uncachedPrimaryKeys = null; for (Serializable primaryKey : primaryKeys) { try (SafeCloseable safeCloseable = ctPersistenceHelper.setCTCollectionIdWithSafeCloseable( BookmarksEntry.class, primaryKey)) { BookmarksEntry bookmarksEntry = (BookmarksEntry)entityCache.getResult( BookmarksEntryImpl.class, primaryKey); if (bookmarksEntry == null) { if (uncachedPrimaryKeys == null) { uncachedPrimaryKeys = new HashSet<>(); } uncachedPrimaryKeys.add(primaryKey); } else { map.put(primaryKey, bookmarksEntry); } } } if (uncachedPrimaryKeys == null) { return map; } if ((databaseInMaxParameters > 0) && (primaryKeys.size() > databaseInMaxParameters)) { Iterator iterator = primaryKeys.iterator(); while (iterator.hasNext()) { Set page = new HashSet<>(); for (int i = 0; (i < databaseInMaxParameters) && iterator.hasNext(); i++) { page.add(iterator.next()); } map.putAll(fetchByPrimaryKeys(page)); } return map; } StringBundler sb = new StringBundler((primaryKeys.size() * 2) + 1); sb.append(getSelectSQL()); sb.append(" WHERE "); sb.append(getPKDBName()); sb.append(" IN ("); for (Serializable primaryKey : primaryKeys) { sb.append((long)primaryKey); sb.append(","); } sb.setIndex(sb.index() - 1); sb.append(")"); String sql = sb.toString(); Session session = null; try { session = openSession(); Query query = session.createQuery(sql); for (BookmarksEntry bookmarksEntry : (List)query.list()) { map.put(bookmarksEntry.getPrimaryKeyObj(), bookmarksEntry); cacheResult(bookmarksEntry); } } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } return map; } /** * Returns all the bookmarks entries. * * @return the bookmarks entries */ @Override public List findAll() { return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the bookmarks entries. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @return the range of bookmarks entries */ @Override public List findAll(int start, int end) { return findAll(start, end, null); } /** * Returns an ordered range of all the bookmarks entries. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of bookmarks entries */ @Override public List findAll( int start, int end, OrderByComparator orderByComparator) { return findAll(start, end, orderByComparator, true); } /** * Returns an ordered range of all the bookmarks entries. * *

* Useful when paginating results. Returns a maximum of end - start instances. start and end are not primary keys, they are indexes in the result set. Thus, 0 refers to the first result in the set. Setting both start and end to QueryUtil#ALL_POS will return the full result set. If orderByComparator is specified, then the query will include the given ORDER BY logic. If orderByComparator is absent, then the query will include the default ORDER BY logic from BookmarksEntryModelImpl. *

* * @param start the lower bound of the range of bookmarks entries * @param end the upper bound of the range of bookmarks entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @param useFinderCache whether to use the finder cache * @return the ordered range of bookmarks entries */ @Override public List findAll( int start, int end, OrderByComparator orderByComparator, boolean useFinderCache) { try (SafeCloseable safeCloseable = ctPersistenceHelper.setCTCollectionIdWithSafeCloseable( BookmarksEntry.class)) { FinderPath finderPath = null; Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { if (useFinderCache) { finderPath = _finderPathWithoutPaginationFindAll; finderArgs = FINDER_ARGS_EMPTY; } } else if (useFinderCache) { finderPath = _finderPathWithPaginationFindAll; finderArgs = new Object[] {start, end, orderByComparator}; } List list = null; if (useFinderCache) { list = (List)finderCache.getResult( finderPath, finderArgs, this); } if (list == null) { StringBundler sb = null; String sql = null; if (orderByComparator != null) { sb = new StringBundler( 2 + (orderByComparator.getOrderByFields().length * 2)); sb.append(_SQL_SELECT_BOOKMARKSENTRY); appendOrderByComparator( sb, _ORDER_BY_ENTITY_ALIAS, orderByComparator); sql = sb.toString(); } else { sql = _SQL_SELECT_BOOKMARKSENTRY; sql = sql.concat(BookmarksEntryModelImpl.ORDER_BY_JPQL); } Session session = null; try { session = openSession(); Query query = session.createQuery(sql); list = (List)QueryUtil.list( query, getDialect(), start, end); cacheResult(list); if (useFinderCache) { finderCache.putResult(finderPath, finderArgs, list); } } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } return list; } } /** * Removes all the bookmarks entries from the database. * */ @Override public void removeAll() { for (BookmarksEntry bookmarksEntry : findAll()) { remove(bookmarksEntry); } } /** * Returns the number of bookmarks entries. * * @return the number of bookmarks entries */ @Override public int countAll() { try (SafeCloseable safeCloseable = ctPersistenceHelper.setCTCollectionIdWithSafeCloseable( BookmarksEntry.class)) { Long count = (Long)finderCache.getResult( _finderPathCountAll, FINDER_ARGS_EMPTY, this); if (count == null) { Session session = null; try { session = openSession(); Query query = session.createQuery( _SQL_COUNT_BOOKMARKSENTRY); count = (Long)query.uniqueResult(); finderCache.putResult( _finderPathCountAll, FINDER_ARGS_EMPTY, count); } catch (Exception exception) { throw processException(exception); } finally { closeSession(session); } } return count.intValue(); } } @Override public Set getBadColumnNames() { return _badColumnNames; } @Override protected EntityCache getEntityCache() { return entityCache; } @Override protected String getPKDBName() { return "entryId"; } @Override protected String getSelectSQL() { return _SQL_SELECT_BOOKMARKSENTRY; } @Override public Set getCTColumnNames( CTColumnResolutionType ctColumnResolutionType) { return _ctColumnNamesMap.getOrDefault( ctColumnResolutionType, Collections.emptySet()); } @Override public List getMappingTableNames() { return _mappingTableNames; } @Override public Map getTableColumnsMap() { return BookmarksEntryModelImpl.TABLE_COLUMNS_MAP; } @Override public String getTableName() { return "BookmarksEntry"; } @Override public List getUniqueIndexColumnNames() { return _uniqueIndexColumnNames; } private static final Map> _ctColumnNamesMap = new EnumMap>( CTColumnResolutionType.class); private static final List _mappingTableNames = new ArrayList(); private static final List _uniqueIndexColumnNames = new ArrayList(); static { Set ctControlColumnNames = new HashSet(); Set ctIgnoreColumnNames = new HashSet(); Set ctMergeColumnNames = new HashSet(); Set ctStrictColumnNames = new HashSet(); ctControlColumnNames.add("mvccVersion"); ctControlColumnNames.add("ctCollectionId"); ctStrictColumnNames.add("uuid_"); ctStrictColumnNames.add("groupId"); ctStrictColumnNames.add("companyId"); ctStrictColumnNames.add("userId"); ctStrictColumnNames.add("userName"); ctStrictColumnNames.add("createDate"); ctIgnoreColumnNames.add("modifiedDate"); ctMergeColumnNames.add("folderId"); ctMergeColumnNames.add("treePath"); ctMergeColumnNames.add("name"); ctMergeColumnNames.add("url"); ctMergeColumnNames.add("description"); ctMergeColumnNames.add("priority"); ctMergeColumnNames.add("lastPublishDate"); ctStrictColumnNames.add("status"); ctStrictColumnNames.add("statusByUserId"); ctStrictColumnNames.add("statusByUserName"); ctStrictColumnNames.add("statusDate"); _ctColumnNamesMap.put( CTColumnResolutionType.CONTROL, ctControlColumnNames); _ctColumnNamesMap.put( CTColumnResolutionType.IGNORE, ctIgnoreColumnNames); _ctColumnNamesMap.put(CTColumnResolutionType.MERGE, ctMergeColumnNames); _ctColumnNamesMap.put( CTColumnResolutionType.PK, Collections.singleton("entryId")); _ctColumnNamesMap.put( CTColumnResolutionType.STRICT, ctStrictColumnNames); _uniqueIndexColumnNames.add(new String[] {"uuid_", "groupId"}); } /** * Initializes the bookmarks entry persistence. */ @Activate public void activate() { _valueObjectFinderCacheListThreshold = GetterUtil.getInteger( PropsUtil.get(PropsKeys.VALUE_OBJECT_FINDER_CACHE_LIST_THRESHOLD)); _finderPathWithPaginationFindAll = new FinderPath( FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0], new String[0], true); _finderPathWithoutPaginationFindAll = new FinderPath( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0], new String[0], true); _finderPathCountAll = new FinderPath( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0], new String[0], false); _finderPathWithPaginationFindByUuid = new FinderPath( FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByUuid", new String[] { String.class.getName(), Integer.class.getName(), Integer.class.getName(), OrderByComparator.class.getName() }, new String[] {"uuid_"}, true); _finderPathWithoutPaginationFindByUuid = new FinderPath( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByUuid", new String[] {String.class.getName()}, new String[] {"uuid_"}, true); _finderPathCountByUuid = new FinderPath( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUuid", new String[] {String.class.getName()}, new String[] {"uuid_"}, false); _finderPathFetchByUUID_G = new FinderPath( FINDER_CLASS_NAME_ENTITY, "fetchByUUID_G", new String[] {String.class.getName(), Long.class.getName()}, new String[] {"uuid_", "groupId"}, true); _finderPathCountByUUID_G = new FinderPath( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUUID_G", new String[] {String.class.getName(), Long.class.getName()}, new String[] {"uuid_", "groupId"}, false); _finderPathWithPaginationFindByUuid_C = new FinderPath( FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByUuid_C", new String[] { String.class.getName(), Long.class.getName(), Integer.class.getName(), Integer.class.getName(), OrderByComparator.class.getName() }, new String[] {"uuid_", "companyId"}, true); _finderPathWithoutPaginationFindByUuid_C = new FinderPath( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByUuid_C", new String[] {String.class.getName(), Long.class.getName()}, new String[] {"uuid_", "companyId"}, true); _finderPathCountByUuid_C = new FinderPath( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUuid_C", new String[] {String.class.getName(), Long.class.getName()}, new String[] {"uuid_", "companyId"}, false); _finderPathWithPaginationFindByCompanyId = new FinderPath( FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByCompanyId", new String[] { Long.class.getName(), Integer.class.getName(), Integer.class.getName(), OrderByComparator.class.getName() }, new String[] {"companyId"}, true); _finderPathWithoutPaginationFindByCompanyId = new FinderPath( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByCompanyId", new String[] {Long.class.getName()}, new String[] {"companyId"}, true); _finderPathCountByCompanyId = new FinderPath( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByCompanyId", new String[] {Long.class.getName()}, new String[] {"companyId"}, false); _finderPathWithPaginationFindByG_F = new FinderPath( FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByG_F", new String[] { Long.class.getName(), Long.class.getName(), Integer.class.getName(), Integer.class.getName(), OrderByComparator.class.getName() }, new String[] {"groupId", "folderId"}, true); _finderPathWithoutPaginationFindByG_F = new FinderPath( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByG_F", new String[] {Long.class.getName(), Long.class.getName()}, new String[] {"groupId", "folderId"}, true); _finderPathCountByG_F = new FinderPath( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_F", new String[] {Long.class.getName(), Long.class.getName()}, new String[] {"groupId", "folderId"}, false); _finderPathWithPaginationCountByG_F = new FinderPath( FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "countByG_F", new String[] {Long.class.getName(), Long.class.getName()}, new String[] {"groupId", "folderId"}, false); _finderPathWithPaginationFindByG_S = new FinderPath( FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByG_S", new String[] { Long.class.getName(), Integer.class.getName(), Integer.class.getName(), Integer.class.getName(), OrderByComparator.class.getName() }, new String[] {"groupId", "status"}, true); _finderPathWithoutPaginationFindByG_S = new FinderPath( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByG_S", new String[] {Long.class.getName(), Integer.class.getName()}, new String[] {"groupId", "status"}, true); _finderPathCountByG_S = new FinderPath( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_S", new String[] {Long.class.getName(), Integer.class.getName()}, new String[] {"groupId", "status"}, false); _finderPathWithPaginationFindByG_NotS = new FinderPath( FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByG_NotS", new String[] { Long.class.getName(), Integer.class.getName(), Integer.class.getName(), Integer.class.getName(), OrderByComparator.class.getName() }, new String[] {"groupId", "status"}, true); _finderPathWithPaginationCountByG_NotS = new FinderPath( FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "countByG_NotS", new String[] {Long.class.getName(), Integer.class.getName()}, new String[] {"groupId", "status"}, false); _finderPathWithPaginationFindByC_NotS = new FinderPath( FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByC_NotS", new String[] { Long.class.getName(), Integer.class.getName(), Integer.class.getName(), Integer.class.getName(), OrderByComparator.class.getName() }, new String[] {"companyId", "status"}, true); _finderPathWithPaginationCountByC_NotS = new FinderPath( FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "countByC_NotS", new String[] {Long.class.getName(), Integer.class.getName()}, new String[] {"companyId", "status"}, false); _finderPathWithPaginationFindByG_U_S = new FinderPath( FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByG_U_S", new String[] { Long.class.getName(), Long.class.getName(), Integer.class.getName(), Integer.class.getName(), Integer.class.getName(), OrderByComparator.class.getName() }, new String[] {"groupId", "userId", "status"}, true); _finderPathWithoutPaginationFindByG_U_S = new FinderPath( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByG_U_S", new String[] { Long.class.getName(), Long.class.getName(), Integer.class.getName() }, new String[] {"groupId", "userId", "status"}, true); _finderPathCountByG_U_S = new FinderPath( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_U_S", new String[] { Long.class.getName(), Long.class.getName(), Integer.class.getName() }, new String[] {"groupId", "userId", "status"}, false); _finderPathWithPaginationFindByG_U_NotS = new FinderPath( FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByG_U_NotS", new String[] { Long.class.getName(), Long.class.getName(), Integer.class.getName(), Integer.class.getName(), Integer.class.getName(), OrderByComparator.class.getName() }, new String[] {"groupId", "userId", "status"}, true); _finderPathWithPaginationCountByG_U_NotS = new FinderPath( FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "countByG_U_NotS", new String[] { Long.class.getName(), Long.class.getName(), Integer.class.getName() }, new String[] {"groupId", "userId", "status"}, false); _finderPathWithPaginationFindByG_F_S = new FinderPath( FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByG_F_S", new String[] { Long.class.getName(), Long.class.getName(), Integer.class.getName(), Integer.class.getName(), Integer.class.getName(), OrderByComparator.class.getName() }, new String[] {"groupId", "folderId", "status"}, true); _finderPathWithoutPaginationFindByG_F_S = new FinderPath( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByG_F_S", new String[] { Long.class.getName(), Long.class.getName(), Integer.class.getName() }, new String[] {"groupId", "folderId", "status"}, true); _finderPathCountByG_F_S = new FinderPath( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_F_S", new String[] { Long.class.getName(), Long.class.getName(), Integer.class.getName() }, new String[] {"groupId", "folderId", "status"}, false); _finderPathWithPaginationCountByG_F_S = new FinderPath( FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "countByG_F_S", new String[] { Long.class.getName(), Long.class.getName(), Integer.class.getName() }, new String[] {"groupId", "folderId", "status"}, false); _finderPathWithPaginationFindByG_F_NotS = new FinderPath( FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByG_F_NotS", new String[] { Long.class.getName(), Long.class.getName(), Integer.class.getName(), Integer.class.getName(), Integer.class.getName(), OrderByComparator.class.getName() }, new String[] {"groupId", "folderId", "status"}, true); _finderPathWithPaginationCountByG_F_NotS = new FinderPath( FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "countByG_F_NotS", new String[] { Long.class.getName(), Long.class.getName(), Integer.class.getName() }, new String[] {"groupId", "folderId", "status"}, false); _finderPathWithPaginationFindByG_U_F_S = new FinderPath( FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByG_U_F_S", new String[] { Long.class.getName(), Long.class.getName(), Long.class.getName(), Integer.class.getName(), Integer.class.getName(), Integer.class.getName(), OrderByComparator.class.getName() }, new String[] {"groupId", "userId", "folderId", "status"}, true); _finderPathWithoutPaginationFindByG_U_F_S = new FinderPath( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByG_U_F_S", new String[] { Long.class.getName(), Long.class.getName(), Long.class.getName(), Integer.class.getName() }, new String[] {"groupId", "userId", "folderId", "status"}, true); _finderPathCountByG_U_F_S = new FinderPath( FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_U_F_S", new String[] { Long.class.getName(), Long.class.getName(), Long.class.getName(), Integer.class.getName() }, new String[] {"groupId", "userId", "folderId", "status"}, false); _finderPathWithPaginationCountByG_U_F_S = new FinderPath( FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "countByG_U_F_S", new String[] { Long.class.getName(), Long.class.getName(), Long.class.getName(), Integer.class.getName() }, new String[] {"groupId", "userId", "folderId", "status"}, false); BookmarksEntryUtil.setPersistence(this); } @Deactivate public void deactivate() { BookmarksEntryUtil.setPersistence(null); entityCache.removeCache(BookmarksEntryImpl.class.getName()); } @Override @Reference( target = BookmarksPersistenceConstants.SERVICE_CONFIGURATION_FILTER, unbind = "-" ) public void setConfiguration(Configuration configuration) { } @Override @Reference( target = BookmarksPersistenceConstants.ORIGIN_BUNDLE_SYMBOLIC_NAME_FILTER, unbind = "-" ) public void setDataSource(DataSource dataSource) { super.setDataSource(dataSource); } @Override @Reference( target = BookmarksPersistenceConstants.ORIGIN_BUNDLE_SYMBOLIC_NAME_FILTER, unbind = "-" ) public void setSessionFactory(SessionFactory sessionFactory) { super.setSessionFactory(sessionFactory); } @Reference protected CTPersistenceHelper ctPersistenceHelper; @Reference protected EntityCache entityCache; @Reference protected FinderCache finderCache; private static final String _SQL_SELECT_BOOKMARKSENTRY = "SELECT bookmarksEntry FROM BookmarksEntry bookmarksEntry"; private static final String _SQL_SELECT_BOOKMARKSENTRY_WHERE = "SELECT bookmarksEntry FROM BookmarksEntry bookmarksEntry WHERE "; private static final String _SQL_COUNT_BOOKMARKSENTRY = "SELECT COUNT(bookmarksEntry) FROM BookmarksEntry bookmarksEntry"; private static final String _SQL_COUNT_BOOKMARKSENTRY_WHERE = "SELECT COUNT(bookmarksEntry) FROM BookmarksEntry bookmarksEntry WHERE "; private static final String _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN = "bookmarksEntry.entryId"; private static final String _FILTER_SQL_SELECT_BOOKMARKSENTRY_WHERE = "SELECT DISTINCT {bookmarksEntry.*} FROM BookmarksEntry bookmarksEntry WHERE "; private static final String _FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_1 = "SELECT {BookmarksEntry.*} FROM (SELECT DISTINCT bookmarksEntry.entryId FROM BookmarksEntry bookmarksEntry WHERE "; private static final String _FILTER_SQL_SELECT_BOOKMARKSENTRY_NO_INLINE_DISTINCT_WHERE_2 = ") TEMP_TABLE INNER JOIN BookmarksEntry ON TEMP_TABLE.entryId = BookmarksEntry.entryId"; private static final String _FILTER_SQL_COUNT_BOOKMARKSENTRY_WHERE = "SELECT COUNT(DISTINCT bookmarksEntry.entryId) AS COUNT_VALUE FROM BookmarksEntry bookmarksEntry WHERE "; private static final String _FILTER_ENTITY_ALIAS = "bookmarksEntry"; private static final String _FILTER_ENTITY_TABLE = "BookmarksEntry"; private static final String _ORDER_BY_ENTITY_ALIAS = "bookmarksEntry."; private static final String _ORDER_BY_ENTITY_TABLE = "BookmarksEntry."; private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No BookmarksEntry exists with the primary key "; private static final String _NO_SUCH_ENTITY_WITH_KEY = "No BookmarksEntry exists with the key {"; private static final Log _log = LogFactoryUtil.getLog( BookmarksEntryPersistenceImpl.class); private static final Set _badColumnNames = SetUtil.fromArray( new String[] {"uuid"}); @Override protected FinderCache getFinderCache() { return finderCache; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy