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

com.liferay.blogs.service.persistence.impl.BlogsEntryPersistenceImpl Maven / Gradle / Ivy

There is a newer version: 5.0.96
Show newest version
/**
 * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
 *
 * This library is free software; you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation; either version 2.1 of the License, or (at your option)
 * any later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 */

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

import com.liferay.blogs.exception.NoSuchEntryException;
import com.liferay.blogs.model.BlogsEntry;
import com.liferay.blogs.model.impl.BlogsEntryImpl;
import com.liferay.blogs.model.impl.BlogsEntryModelImpl;
import com.liferay.blogs.service.persistence.BlogsEntryPersistence;
import com.liferay.blogs.service.persistence.impl.constants.BlogsPersistenceConstants;
import com.liferay.petra.string.StringBundler;
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.exception.SystemException;
import com.liferay.portal.kernel.log.Log;
import com.liferay.portal.kernel.log.LogFactoryUtil;
import com.liferay.portal.kernel.sanitizer.Sanitizer;
import com.liferay.portal.kernel.sanitizer.SanitizerException;
import com.liferay.portal.kernel.sanitizer.SanitizerUtil;
import com.liferay.portal.kernel.security.auth.CompanyThreadLocal;
import com.liferay.portal.kernel.security.auth.PrincipalThreadLocal;
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.impl.BasePersistenceImpl;
import com.liferay.portal.kernel.util.ArrayUtil;
import com.liferay.portal.kernel.util.ContentTypes;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.OrderByComparator;
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.sql.Timestamp;

import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;

import javax.sql.DataSource;

import org.osgi.annotation.versioning.ProviderType;
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 blogs entry service.
 *
 * 

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

* * @author Brian Wing Shun Chan * @generated */ @Component(service = BlogsEntryPersistence.class) @ProviderType public class BlogsEntryPersistenceImpl extends BasePersistenceImpl implements BlogsEntryPersistence { /* * NOTE FOR DEVELOPERS: * * Never modify or reference this class directly. Always use BlogsEntryUtil to access the blogs entry persistence. Modify service.xml and rerun ServiceBuilder to regenerate this class. */ public static final String FINDER_CLASS_NAME_ENTITY = BlogsEntryImpl.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 blogs entries where uuid = ?. * * @param uuid the uuid * @return the matching blogs entries */ @Override public List findByUuid(String uuid) { return findByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the blogs 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param uuid the uuid * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @return the range of matching blogs entries */ @Override public List findByUuid(String uuid, int start, int end) { return findByUuid(uuid, start, end, null); } /** * Returns an ordered range of all the blogs 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param uuid the uuid * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching blogs 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 blogs 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param uuid the uuid * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @param retrieveFromCache whether to retrieve from the finder cache * @return the ordered range of matching blogs entries */ @Override public List findByUuid( String uuid, int start, int end, OrderByComparator orderByComparator, boolean retrieveFromCache) { uuid = Objects.toString(uuid, ""); boolean pagination = true; FinderPath finderPath = null; Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { pagination = false; finderPath = _finderPathWithoutPaginationFindByUuid; finderArgs = new Object[] {uuid}; } else { finderPath = _finderPathWithPaginationFindByUuid; finderArgs = new Object[] {uuid, start, end, orderByComparator}; } List list = null; if (retrieveFromCache) { list = (List)finderCache.getResult( finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (BlogsEntry blogsEntry : list) { if (!uuid.equals(blogsEntry.getUuid())) { list = null; break; } } } } if (list == null) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 3 + (orderByComparator.getOrderByFields().length * 2)); } else { query = new StringBundler(3); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); boolean bindUuid = false; if (uuid.isEmpty()) { query.append(_FINDER_COLUMN_UUID_UUID_3); } else { bindUuid = true; query.append(_FINDER_COLUMN_UUID_UUID_2); } if (orderByComparator != null) { appendOrderByComparator( query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); if (bindUuid) { qPos.add(uuid); } if (!pagination) { list = (List)QueryUtil.list( q, getDialect(), start, end, false); Collections.sort(list); list = Collections.unmodifiableList(list); } else { list = (List)QueryUtil.list( q, getDialect(), start, end); } cacheResult(list); finderCache.putResult(finderPath, finderArgs, list); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; } /** * Returns the first blogs 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 blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByUuid_First( String uuid, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByUuid_First(uuid, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(4); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("uuid="); msg.append(uuid); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the first blogs 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 blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry 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 blogs 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 blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByUuid_Last( String uuid, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByUuid_Last(uuid, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(4); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("uuid="); msg.append(uuid); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the last blogs 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 blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry 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 blogs entries before and after the current blogs entry in the ordered set where uuid = ?. * * @param entryId the primary key of the current blogs entry * @param uuid the uuid * @param orderByComparator the comparator to order the set by (optionally null) * @return the previous, current, and next blogs entry * @throws NoSuchEntryException if a blogs entry with the primary key could not be found */ @Override public BlogsEntry[] findByUuid_PrevAndNext( long entryId, String uuid, OrderByComparator orderByComparator) throws NoSuchEntryException { uuid = Objects.toString(uuid, ""); BlogsEntry blogsEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BlogsEntry[] array = new BlogsEntryImpl[3]; array[0] = getByUuid_PrevAndNext( session, blogsEntry, uuid, orderByComparator, true); array[1] = blogsEntry; array[2] = getByUuid_PrevAndNext( session, blogsEntry, uuid, orderByComparator, false); return array; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } protected BlogsEntry getByUuid_PrevAndNext( Session session, BlogsEntry blogsEntry, String uuid, OrderByComparator orderByComparator, boolean previous) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 4 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(3); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); boolean bindUuid = false; if (uuid.isEmpty()) { query.append(_FINDER_COLUMN_UUID_UUID_3); } else { bindUuid = true; query.append(_FINDER_COLUMN_UUID_UUID_2); } if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { query.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByConditionFields[i]); if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN_HAS_NEXT); } else { query.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN); } else { query.append(WHERE_LESSER_THAN); } } } query.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByFields[i]); if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC_HAS_NEXT); } else { query.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC); } else { query.append(ORDER_BY_DESC); } } } } else { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Query q = session.createQuery(sql); q.setFirstResult(0); q.setMaxResults(2); QueryPos qPos = QueryPos.getInstance(q); if (bindUuid) { qPos.add(uuid); } if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues(blogsEntry)) { qPos.add(orderByConditionValue); } } List list = q.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Removes all the blogs entries where uuid = ? from the database. * * @param uuid the uuid */ @Override public void removeByUuid(String uuid) { for (BlogsEntry blogsEntry : findByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(blogsEntry); } } /** * Returns the number of blogs entries where uuid = ?. * * @param uuid the uuid * @return the number of matching blogs entries */ @Override public int countByUuid(String uuid) { uuid = Objects.toString(uuid, ""); FinderPath finderPath = _finderPathCountByUuid; Object[] finderArgs = new Object[] {uuid}; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(2); query.append(_SQL_COUNT_BLOGSENTRY_WHERE); boolean bindUuid = false; if (uuid.isEmpty()) { query.append(_FINDER_COLUMN_UUID_UUID_3); } else { bindUuid = true; query.append(_FINDER_COLUMN_UUID_UUID_2); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); if (bindUuid) { qPos.add(uuid); } count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); } private static final String _FINDER_COLUMN_UUID_UUID_2 = "blogsEntry.uuid = ?"; private static final String _FINDER_COLUMN_UUID_UUID_3 = "(blogsEntry.uuid IS NULL OR blogsEntry.uuid = '')"; private FinderPath _finderPathFetchByUUID_G; private FinderPath _finderPathCountByUUID_G; /** * Returns the blogs 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 blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByUUID_G(String uuid, long groupId) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByUUID_G(uuid, groupId); if (blogsEntry == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("uuid="); msg.append(uuid); msg.append(", groupId="); msg.append(groupId); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchEntryException(msg.toString()); } return blogsEntry; } /** * Returns the blogs 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 blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry fetchByUUID_G(String uuid, long groupId) { return fetchByUUID_G(uuid, groupId, true); } /** * Returns the blogs 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 retrieveFromCache whether to retrieve from the finder cache * @return the matching blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry fetchByUUID_G( String uuid, long groupId, boolean retrieveFromCache) { uuid = Objects.toString(uuid, ""); Object[] finderArgs = new Object[] {uuid, groupId}; Object result = null; if (retrieveFromCache) { result = finderCache.getResult( _finderPathFetchByUUID_G, finderArgs, this); } if (result instanceof BlogsEntry) { BlogsEntry blogsEntry = (BlogsEntry)result; if (!Objects.equals(uuid, blogsEntry.getUuid()) || (groupId != blogsEntry.getGroupId())) { result = null; } } if (result == null) { StringBundler query = new StringBundler(4); query.append(_SQL_SELECT_BLOGSENTRY_WHERE); boolean bindUuid = false; if (uuid.isEmpty()) { query.append(_FINDER_COLUMN_UUID_G_UUID_3); } else { bindUuid = true; query.append(_FINDER_COLUMN_UUID_G_UUID_2); } query.append(_FINDER_COLUMN_UUID_G_GROUPID_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); if (bindUuid) { qPos.add(uuid); } qPos.add(groupId); List list = q.list(); if (list.isEmpty()) { finderCache.putResult( _finderPathFetchByUUID_G, finderArgs, list); } else { BlogsEntry blogsEntry = list.get(0); result = blogsEntry; cacheResult(blogsEntry); } } catch (Exception e) { finderCache.removeResult(_finderPathFetchByUUID_G, finderArgs); throw processException(e); } finally { closeSession(session); } } if (result instanceof List) { return null; } else { return (BlogsEntry)result; } } /** * Removes the blogs entry where uuid = ? and groupId = ? from the database. * * @param uuid the uuid * @param groupId the group ID * @return the blogs entry that was removed */ @Override public BlogsEntry removeByUUID_G(String uuid, long groupId) throws NoSuchEntryException { BlogsEntry blogsEntry = findByUUID_G(uuid, groupId); return remove(blogsEntry); } /** * Returns the number of blogs entries where uuid = ? and groupId = ?. * * @param uuid the uuid * @param groupId the group ID * @return the number of matching blogs entries */ @Override public int countByUUID_G(String uuid, long groupId) { 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 query = new StringBundler(3); query.append(_SQL_COUNT_BLOGSENTRY_WHERE); boolean bindUuid = false; if (uuid.isEmpty()) { query.append(_FINDER_COLUMN_UUID_G_UUID_3); } else { bindUuid = true; query.append(_FINDER_COLUMN_UUID_G_UUID_2); } query.append(_FINDER_COLUMN_UUID_G_GROUPID_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); if (bindUuid) { qPos.add(uuid); } qPos.add(groupId); count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); } private static final String _FINDER_COLUMN_UUID_G_UUID_2 = "blogsEntry.uuid = ? AND "; private static final String _FINDER_COLUMN_UUID_G_UUID_3 = "(blogsEntry.uuid IS NULL OR blogsEntry.uuid = '') AND "; private static final String _FINDER_COLUMN_UUID_G_GROUPID_2 = "blogsEntry.groupId = ?"; private FinderPath _finderPathWithPaginationFindByUuid_C; private FinderPath _finderPathWithoutPaginationFindByUuid_C; private FinderPath _finderPathCountByUuid_C; /** * Returns all the blogs entries where uuid = ? and companyId = ?. * * @param uuid the uuid * @param companyId the company ID * @return the matching blogs 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 blogs 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param uuid the uuid * @param companyId the company ID * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @return the range of matching blogs 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 blogs 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param uuid the uuid * @param companyId the company ID * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching blogs 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 blogs 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param uuid the uuid * @param companyId the company ID * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @param retrieveFromCache whether to retrieve from the finder cache * @return the ordered range of matching blogs entries */ @Override public List findByUuid_C( String uuid, long companyId, int start, int end, OrderByComparator orderByComparator, boolean retrieveFromCache) { uuid = Objects.toString(uuid, ""); boolean pagination = true; FinderPath finderPath = null; Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { pagination = false; finderPath = _finderPathWithoutPaginationFindByUuid_C; finderArgs = new Object[] {uuid, companyId}; } else { finderPath = _finderPathWithPaginationFindByUuid_C; finderArgs = new Object[] { uuid, companyId, start, end, orderByComparator }; } List list = null; if (retrieveFromCache) { list = (List)finderCache.getResult( finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (BlogsEntry blogsEntry : list) { if (!uuid.equals(blogsEntry.getUuid()) || (companyId != blogsEntry.getCompanyId())) { list = null; break; } } } } if (list == null) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 4 + (orderByComparator.getOrderByFields().length * 2)); } else { query = new StringBundler(4); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); boolean bindUuid = false; if (uuid.isEmpty()) { query.append(_FINDER_COLUMN_UUID_C_UUID_3); } else { bindUuid = true; query.append(_FINDER_COLUMN_UUID_C_UUID_2); } query.append(_FINDER_COLUMN_UUID_C_COMPANYID_2); if (orderByComparator != null) { appendOrderByComparator( query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); if (bindUuid) { qPos.add(uuid); } qPos.add(companyId); if (!pagination) { list = (List)QueryUtil.list( q, getDialect(), start, end, false); Collections.sort(list); list = Collections.unmodifiableList(list); } else { list = (List)QueryUtil.list( q, getDialect(), start, end); } cacheResult(list); finderCache.putResult(finderPath, finderArgs, list); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; } /** * Returns the first blogs 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 blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByUuid_C_First( String uuid, long companyId, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByUuid_C_First( uuid, companyId, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("uuid="); msg.append(uuid); msg.append(", companyId="); msg.append(companyId); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the first blogs 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 blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry 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 blogs 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 blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByUuid_C_Last( String uuid, long companyId, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByUuid_C_Last( uuid, companyId, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("uuid="); msg.append(uuid); msg.append(", companyId="); msg.append(companyId); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the last blogs 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 blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry 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 blogs entries before and after the current blogs entry in the ordered set where uuid = ? and companyId = ?. * * @param entryId the primary key of the current blogs 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 blogs entry * @throws NoSuchEntryException if a blogs entry with the primary key could not be found */ @Override public BlogsEntry[] findByUuid_C_PrevAndNext( long entryId, String uuid, long companyId, OrderByComparator orderByComparator) throws NoSuchEntryException { uuid = Objects.toString(uuid, ""); BlogsEntry blogsEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BlogsEntry[] array = new BlogsEntryImpl[3]; array[0] = getByUuid_C_PrevAndNext( session, blogsEntry, uuid, companyId, orderByComparator, true); array[1] = blogsEntry; array[2] = getByUuid_C_PrevAndNext( session, blogsEntry, uuid, companyId, orderByComparator, false); return array; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } protected BlogsEntry getByUuid_C_PrevAndNext( Session session, BlogsEntry blogsEntry, String uuid, long companyId, OrderByComparator orderByComparator, boolean previous) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 5 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(4); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); boolean bindUuid = false; if (uuid.isEmpty()) { query.append(_FINDER_COLUMN_UUID_C_UUID_3); } else { bindUuid = true; query.append(_FINDER_COLUMN_UUID_C_UUID_2); } query.append(_FINDER_COLUMN_UUID_C_COMPANYID_2); if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { query.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByConditionFields[i]); if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN_HAS_NEXT); } else { query.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN); } else { query.append(WHERE_LESSER_THAN); } } } query.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByFields[i]); if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC_HAS_NEXT); } else { query.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC); } else { query.append(ORDER_BY_DESC); } } } } else { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Query q = session.createQuery(sql); q.setFirstResult(0); q.setMaxResults(2); QueryPos qPos = QueryPos.getInstance(q); if (bindUuid) { qPos.add(uuid); } qPos.add(companyId); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues(blogsEntry)) { qPos.add(orderByConditionValue); } } List list = q.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Removes all the blogs 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 (BlogsEntry blogsEntry : findByUuid_C( uuid, companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(blogsEntry); } } /** * Returns the number of blogs entries where uuid = ? and companyId = ?. * * @param uuid the uuid * @param companyId the company ID * @return the number of matching blogs entries */ @Override public int countByUuid_C(String uuid, long companyId) { 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 query = new StringBundler(3); query.append(_SQL_COUNT_BLOGSENTRY_WHERE); boolean bindUuid = false; if (uuid.isEmpty()) { query.append(_FINDER_COLUMN_UUID_C_UUID_3); } else { bindUuid = true; query.append(_FINDER_COLUMN_UUID_C_UUID_2); } query.append(_FINDER_COLUMN_UUID_C_COMPANYID_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); if (bindUuid) { qPos.add(uuid); } qPos.add(companyId); count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); } private static final String _FINDER_COLUMN_UUID_C_UUID_2 = "blogsEntry.uuid = ? AND "; private static final String _FINDER_COLUMN_UUID_C_UUID_3 = "(blogsEntry.uuid IS NULL OR blogsEntry.uuid = '') AND "; private static final String _FINDER_COLUMN_UUID_C_COMPANYID_2 = "blogsEntry.companyId = ?"; private FinderPath _finderPathWithPaginationFindByGroupId; private FinderPath _finderPathWithoutPaginationFindByGroupId; private FinderPath _finderPathCountByGroupId; /** * Returns all the blogs entries where groupId = ?. * * @param groupId the group ID * @return the matching blogs entries */ @Override public List findByGroupId(long groupId) { return findByGroupId( groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the blogs entries where groupId = ?. * *

* 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

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

* 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

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

* 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @param retrieveFromCache whether to retrieve from the finder cache * @return the ordered range of matching blogs entries */ @Override public List findByGroupId( long groupId, int start, int end, OrderByComparator orderByComparator, boolean retrieveFromCache) { boolean pagination = true; FinderPath finderPath = null; Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { pagination = false; finderPath = _finderPathWithoutPaginationFindByGroupId; finderArgs = new Object[] {groupId}; } else { finderPath = _finderPathWithPaginationFindByGroupId; finderArgs = new Object[] {groupId, start, end, orderByComparator}; } List list = null; if (retrieveFromCache) { list = (List)finderCache.getResult( finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (BlogsEntry blogsEntry : list) { if ((groupId != blogsEntry.getGroupId())) { list = null; break; } } } } if (list == null) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 3 + (orderByComparator.getOrderByFields().length * 2)); } else { query = new StringBundler(3); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_GROUPID_GROUPID_2); if (orderByComparator != null) { appendOrderByComparator( query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (!pagination) { list = (List)QueryUtil.list( q, getDialect(), start, end, false); Collections.sort(list); list = Collections.unmodifiableList(list); } else { list = (List)QueryUtil.list( q, getDialect(), start, end); } cacheResult(list); finderCache.putResult(finderPath, finderArgs, list); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; } /** * Returns the first blogs entry in the ordered set where groupId = ?. * * @param groupId the group ID * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByGroupId_First( long groupId, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByGroupId_First( groupId, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(4); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("groupId="); msg.append(groupId); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the first blogs entry in the ordered set where groupId = ?. * * @param groupId the group ID * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry fetchByGroupId_First( long groupId, OrderByComparator orderByComparator) { List list = findByGroupId(groupId, 0, 1, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the last blogs entry in the ordered set where groupId = ?. * * @param groupId the group ID * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByGroupId_Last( long groupId, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByGroupId_Last(groupId, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(4); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("groupId="); msg.append(groupId); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the last blogs entry in the ordered set where groupId = ?. * * @param groupId the group ID * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry fetchByGroupId_Last( long groupId, OrderByComparator orderByComparator) { int count = countByGroupId(groupId); if (count == 0) { return null; } List list = findByGroupId( groupId, count - 1, count, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the blogs entries before and after the current blogs entry in the ordered set where groupId = ?. * * @param entryId the primary key of the current blogs entry * @param groupId the group ID * @param orderByComparator the comparator to order the set by (optionally null) * @return the previous, current, and next blogs entry * @throws NoSuchEntryException if a blogs entry with the primary key could not be found */ @Override public BlogsEntry[] findByGroupId_PrevAndNext( long entryId, long groupId, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BlogsEntry[] array = new BlogsEntryImpl[3]; array[0] = getByGroupId_PrevAndNext( session, blogsEntry, groupId, orderByComparator, true); array[1] = blogsEntry; array[2] = getByGroupId_PrevAndNext( session, blogsEntry, groupId, orderByComparator, false); return array; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } protected BlogsEntry getByGroupId_PrevAndNext( Session session, BlogsEntry blogsEntry, long groupId, OrderByComparator orderByComparator, boolean previous) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 4 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(3); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_GROUPID_GROUPID_2); if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { query.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByConditionFields[i]); if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN_HAS_NEXT); } else { query.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN); } else { query.append(WHERE_LESSER_THAN); } } } query.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByFields[i]); if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC_HAS_NEXT); } else { query.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC); } else { query.append(ORDER_BY_DESC); } } } } else { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Query q = session.createQuery(sql); q.setFirstResult(0); q.setMaxResults(2); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues(blogsEntry)) { qPos.add(orderByConditionValue); } } List list = q.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Returns all the blogs entries that the user has permission to view where groupId = ?. * * @param groupId the group ID * @return the matching blogs entries that the user has permission to view */ @Override public List filterFindByGroupId(long groupId) { return filterFindByGroupId( groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the blogs entries that the user has permission to view where groupId = ?. * *

* 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

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

* 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching blogs entries that the user has permission to view */ @Override public List filterFindByGroupId( long groupId, int start, int end, OrderByComparator orderByComparator) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByGroupId(groupId, start, end, orderByComparator); } StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 3 + (orderByComparator.getOrderByFields().length * 2)); } else { query = new StringBundler(4); } if (getDB().isSupportsInlineDistinct()) { query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE); } else { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1); } query.append(_FINDER_COLUMN_GROUPID_GROUPID_2); if (!getDB().isSupportsInlineDistinct()) { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { if (getDB().isSupportsInlineDistinct()) { appendOrderByComparator( query, _ORDER_BY_ENTITY_ALIAS, orderByComparator, true); } else { appendOrderByComparator( query, _ORDER_BY_ENTITY_TABLE, orderByComparator, true); } } else { if (getDB().isSupportsInlineDistinct()) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } else { query.append(BlogsEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck( query.toString(), BlogsEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery q = session.createSynchronizedSQLQuery(sql); if (getDB().isSupportsInlineDistinct()) { q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class); } else { q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class); } QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); return (List)QueryUtil.list( q, getDialect(), start, end); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } /** * Returns the blogs entries before and after the current blogs entry in the ordered set of blogs entries that the user has permission to view where groupId = ?. * * @param entryId the primary key of the current blogs entry * @param groupId the group ID * @param orderByComparator the comparator to order the set by (optionally null) * @return the previous, current, and next blogs entry * @throws NoSuchEntryException if a blogs entry with the primary key could not be found */ @Override public BlogsEntry[] filterFindByGroupId_PrevAndNext( long entryId, long groupId, OrderByComparator orderByComparator) throws NoSuchEntryException { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByGroupId_PrevAndNext( entryId, groupId, orderByComparator); } BlogsEntry blogsEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BlogsEntry[] array = new BlogsEntryImpl[3]; array[0] = filterGetByGroupId_PrevAndNext( session, blogsEntry, groupId, orderByComparator, true); array[1] = blogsEntry; array[2] = filterGetByGroupId_PrevAndNext( session, blogsEntry, groupId, orderByComparator, false); return array; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } protected BlogsEntry filterGetByGroupId_PrevAndNext( Session session, BlogsEntry blogsEntry, long groupId, OrderByComparator orderByComparator, boolean previous) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 5 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(4); } if (getDB().isSupportsInlineDistinct()) { query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE); } else { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1); } query.append(_FINDER_COLUMN_GROUPID_GROUPID_2); if (!getDB().isSupportsInlineDistinct()) { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { query.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { if (getDB().isSupportsInlineDistinct()) { query.append( getColumnName( _ORDER_BY_ENTITY_ALIAS, orderByConditionFields[i], true)); } else { query.append( getColumnName( _ORDER_BY_ENTITY_TABLE, orderByConditionFields[i], true)); } if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN_HAS_NEXT); } else { query.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN); } else { query.append(WHERE_LESSER_THAN); } } } query.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { if (getDB().isSupportsInlineDistinct()) { query.append( getColumnName( _ORDER_BY_ENTITY_ALIAS, orderByFields[i], true)); } else { query.append( getColumnName( _ORDER_BY_ENTITY_TABLE, orderByFields[i], true)); } if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC_HAS_NEXT); } else { query.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC); } else { query.append(ORDER_BY_DESC); } } } } else { if (getDB().isSupportsInlineDistinct()) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } else { query.append(BlogsEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck( query.toString(), BlogsEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); SQLQuery q = session.createSynchronizedSQLQuery(sql); q.setFirstResult(0); q.setMaxResults(2); if (getDB().isSupportsInlineDistinct()) { q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class); } else { q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class); } QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues(blogsEntry)) { qPos.add(orderByConditionValue); } } List list = q.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Removes all the blogs entries where groupId = ? from the database. * * @param groupId the group ID */ @Override public void removeByGroupId(long groupId) { for (BlogsEntry blogsEntry : findByGroupId( groupId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(blogsEntry); } } /** * Returns the number of blogs entries where groupId = ?. * * @param groupId the group ID * @return the number of matching blogs entries */ @Override public int countByGroupId(long groupId) { FinderPath finderPath = _finderPathCountByGroupId; Object[] finderArgs = new Object[] {groupId}; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(2); query.append(_SQL_COUNT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_GROUPID_GROUPID_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); } /** * Returns the number of blogs entries that the user has permission to view where groupId = ?. * * @param groupId the group ID * @return the number of matching blogs entries that the user has permission to view */ @Override public int filterCountByGroupId(long groupId) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return countByGroupId(groupId); } StringBundler query = new StringBundler(2); query.append(_FILTER_SQL_COUNT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_GROUPID_GROUPID_2); String sql = InlineSQLHelperUtil.replacePermissionCheck( query.toString(), BlogsEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery q = session.createSynchronizedSQLQuery(sql); q.addScalar( COUNT_COLUMN_NAME, com.liferay.portal.kernel.dao.orm.Type.LONG); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); Long count = (Long)q.uniqueResult(); return count.intValue(); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } private static final String _FINDER_COLUMN_GROUPID_GROUPID_2 = "blogsEntry.groupId = ?"; private FinderPath _finderPathWithPaginationFindByCompanyId; private FinderPath _finderPathWithoutPaginationFindByCompanyId; private FinderPath _finderPathCountByCompanyId; /** * Returns all the blogs entries where companyId = ?. * * @param companyId the company ID * @return the matching blogs entries */ @Override public List findByCompanyId(long companyId) { return findByCompanyId( companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the blogs 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param companyId the company ID * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @return the range of matching blogs entries */ @Override public List findByCompanyId( long companyId, int start, int end) { return findByCompanyId(companyId, start, end, null); } /** * Returns an ordered range of all the blogs 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param companyId the company ID * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching blogs 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 blogs 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param companyId the company ID * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @param retrieveFromCache whether to retrieve from the finder cache * @return the ordered range of matching blogs entries */ @Override public List findByCompanyId( long companyId, int start, int end, OrderByComparator orderByComparator, boolean retrieveFromCache) { boolean pagination = true; FinderPath finderPath = null; Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { pagination = false; finderPath = _finderPathWithoutPaginationFindByCompanyId; finderArgs = new Object[] {companyId}; } else { finderPath = _finderPathWithPaginationFindByCompanyId; finderArgs = new Object[] { companyId, start, end, orderByComparator }; } List list = null; if (retrieveFromCache) { list = (List)finderCache.getResult( finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (BlogsEntry blogsEntry : list) { if ((companyId != blogsEntry.getCompanyId())) { list = null; break; } } } } if (list == null) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 3 + (orderByComparator.getOrderByFields().length * 2)); } else { query = new StringBundler(3); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2); if (orderByComparator != null) { appendOrderByComparator( query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(companyId); if (!pagination) { list = (List)QueryUtil.list( q, getDialect(), start, end, false); Collections.sort(list); list = Collections.unmodifiableList(list); } else { list = (List)QueryUtil.list( q, getDialect(), start, end); } cacheResult(list); finderCache.putResult(finderPath, finderArgs, list); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; } /** * Returns the first blogs 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 blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByCompanyId_First( long companyId, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByCompanyId_First( companyId, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(4); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("companyId="); msg.append(companyId); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the first blogs 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 blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry 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 blogs 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 blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByCompanyId_Last( long companyId, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByCompanyId_Last( companyId, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(4); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("companyId="); msg.append(companyId); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the last blogs 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 blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry 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 blogs entries before and after the current blogs entry in the ordered set where companyId = ?. * * @param entryId the primary key of the current blogs entry * @param companyId the company ID * @param orderByComparator the comparator to order the set by (optionally null) * @return the previous, current, and next blogs entry * @throws NoSuchEntryException if a blogs entry with the primary key could not be found */ @Override public BlogsEntry[] findByCompanyId_PrevAndNext( long entryId, long companyId, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BlogsEntry[] array = new BlogsEntryImpl[3]; array[0] = getByCompanyId_PrevAndNext( session, blogsEntry, companyId, orderByComparator, true); array[1] = blogsEntry; array[2] = getByCompanyId_PrevAndNext( session, blogsEntry, companyId, orderByComparator, false); return array; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } protected BlogsEntry getByCompanyId_PrevAndNext( Session session, BlogsEntry blogsEntry, long companyId, OrderByComparator orderByComparator, boolean previous) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 4 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(3); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2); if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { query.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByConditionFields[i]); if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN_HAS_NEXT); } else { query.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN); } else { query.append(WHERE_LESSER_THAN); } } } query.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByFields[i]); if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC_HAS_NEXT); } else { query.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC); } else { query.append(ORDER_BY_DESC); } } } } else { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Query q = session.createQuery(sql); q.setFirstResult(0); q.setMaxResults(2); QueryPos qPos = QueryPos.getInstance(q); qPos.add(companyId); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues(blogsEntry)) { qPos.add(orderByConditionValue); } } List list = q.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Removes all the blogs entries where companyId = ? from the database. * * @param companyId the company ID */ @Override public void removeByCompanyId(long companyId) { for (BlogsEntry blogsEntry : findByCompanyId( companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(blogsEntry); } } /** * Returns the number of blogs entries where companyId = ?. * * @param companyId the company ID * @return the number of matching blogs entries */ @Override public int countByCompanyId(long companyId) { FinderPath finderPath = _finderPathCountByCompanyId; Object[] finderArgs = new Object[] {companyId}; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(2); query.append(_SQL_COUNT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(companyId); count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); } private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 = "blogsEntry.companyId = ?"; private FinderPath _finderPathFetchByG_UT; private FinderPath _finderPathCountByG_UT; /** * Returns the blogs entry where groupId = ? and urlTitle = ? or throws a NoSuchEntryException if it could not be found. * * @param groupId the group ID * @param urlTitle the url title * @return the matching blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByG_UT(long groupId, String urlTitle) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByG_UT(groupId, urlTitle); if (blogsEntry == null) { StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("groupId="); msg.append(groupId); msg.append(", urlTitle="); msg.append(urlTitle); msg.append("}"); if (_log.isDebugEnabled()) { _log.debug(msg.toString()); } throw new NoSuchEntryException(msg.toString()); } return blogsEntry; } /** * Returns the blogs entry where groupId = ? and urlTitle = ? or returns null if it could not be found. Uses the finder cache. * * @param groupId the group ID * @param urlTitle the url title * @return the matching blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry fetchByG_UT(long groupId, String urlTitle) { return fetchByG_UT(groupId, urlTitle, true); } /** * Returns the blogs entry where groupId = ? and urlTitle = ? or returns null if it could not be found, optionally using the finder cache. * * @param groupId the group ID * @param urlTitle the url title * @param retrieveFromCache whether to retrieve from the finder cache * @return the matching blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry fetchByG_UT( long groupId, String urlTitle, boolean retrieveFromCache) { urlTitle = Objects.toString(urlTitle, ""); Object[] finderArgs = new Object[] {groupId, urlTitle}; Object result = null; if (retrieveFromCache) { result = finderCache.getResult( _finderPathFetchByG_UT, finderArgs, this); } if (result instanceof BlogsEntry) { BlogsEntry blogsEntry = (BlogsEntry)result; if ((groupId != blogsEntry.getGroupId()) || !Objects.equals(urlTitle, blogsEntry.getUrlTitle())) { result = null; } } if (result == null) { StringBundler query = new StringBundler(4); query.append(_SQL_SELECT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_UT_GROUPID_2); boolean bindUrlTitle = false; if (urlTitle.isEmpty()) { query.append(_FINDER_COLUMN_G_UT_URLTITLE_3); } else { bindUrlTitle = true; query.append(_FINDER_COLUMN_G_UT_URLTITLE_2); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (bindUrlTitle) { qPos.add(urlTitle); } List list = q.list(); if (list.isEmpty()) { finderCache.putResult( _finderPathFetchByG_UT, finderArgs, list); } else { BlogsEntry blogsEntry = list.get(0); result = blogsEntry; cacheResult(blogsEntry); } } catch (Exception e) { finderCache.removeResult(_finderPathFetchByG_UT, finderArgs); throw processException(e); } finally { closeSession(session); } } if (result instanceof List) { return null; } else { return (BlogsEntry)result; } } /** * Removes the blogs entry where groupId = ? and urlTitle = ? from the database. * * @param groupId the group ID * @param urlTitle the url title * @return the blogs entry that was removed */ @Override public BlogsEntry removeByG_UT(long groupId, String urlTitle) throws NoSuchEntryException { BlogsEntry blogsEntry = findByG_UT(groupId, urlTitle); return remove(blogsEntry); } /** * Returns the number of blogs entries where groupId = ? and urlTitle = ?. * * @param groupId the group ID * @param urlTitle the url title * @return the number of matching blogs entries */ @Override public int countByG_UT(long groupId, String urlTitle) { urlTitle = Objects.toString(urlTitle, ""); FinderPath finderPath = _finderPathCountByG_UT; Object[] finderArgs = new Object[] {groupId, urlTitle}; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(3); query.append(_SQL_COUNT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_UT_GROUPID_2); boolean bindUrlTitle = false; if (urlTitle.isEmpty()) { query.append(_FINDER_COLUMN_G_UT_URLTITLE_3); } else { bindUrlTitle = true; query.append(_FINDER_COLUMN_G_UT_URLTITLE_2); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (bindUrlTitle) { qPos.add(urlTitle); } count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); } private static final String _FINDER_COLUMN_G_UT_GROUPID_2 = "blogsEntry.groupId = ? AND "; private static final String _FINDER_COLUMN_G_UT_URLTITLE_2 = "blogsEntry.urlTitle = ?"; private static final String _FINDER_COLUMN_G_UT_URLTITLE_3 = "(blogsEntry.urlTitle IS NULL OR blogsEntry.urlTitle = '')"; private FinderPath _finderPathWithPaginationFindByG_LtD; private FinderPath _finderPathWithPaginationCountByG_LtD; /** * Returns all the blogs entries where groupId = ? and displayDate < ?. * * @param groupId the group ID * @param displayDate the display date * @return the matching blogs entries */ @Override public List findByG_LtD(long groupId, Date displayDate) { return findByG_LtD( groupId, displayDate, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the blogs entries where groupId = ? and displayDate < ?. * *

* 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

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

* 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

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

* 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param displayDate the display date * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @param retrieveFromCache whether to retrieve from the finder cache * @return the ordered range of matching blogs entries */ @Override public List findByG_LtD( long groupId, Date displayDate, int start, int end, OrderByComparator orderByComparator, boolean retrieveFromCache) { boolean pagination = true; FinderPath finderPath = null; Object[] finderArgs = null; finderPath = _finderPathWithPaginationFindByG_LtD; finderArgs = new Object[] { groupId, _getTime(displayDate), start, end, orderByComparator }; List list = null; if (retrieveFromCache) { list = (List)finderCache.getResult( finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (BlogsEntry blogsEntry : list) { if ((groupId != blogsEntry.getGroupId()) || (displayDate.getTime() <= blogsEntry.getDisplayDate().getTime())) { list = null; break; } } } } if (list == null) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 4 + (orderByComparator.getOrderByFields().length * 2)); } else { query = new StringBundler(4); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_LTD_GROUPID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_LTD_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_LTD_DISPLAYDATE_2); } if (orderByComparator != null) { appendOrderByComparator( query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } if (!pagination) { list = (List)QueryUtil.list( q, getDialect(), start, end, false); Collections.sort(list); list = Collections.unmodifiableList(list); } else { list = (List)QueryUtil.list( q, getDialect(), start, end); } cacheResult(list); finderCache.putResult(finderPath, finderArgs, list); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; } /** * Returns the first blogs entry in the ordered set where groupId = ? and displayDate < ?. * * @param groupId the group ID * @param displayDate the display date * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByG_LtD_First( long groupId, Date displayDate, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByG_LtD_First( groupId, displayDate, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("groupId="); msg.append(groupId); msg.append(", displayDate="); msg.append(displayDate); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the first blogs entry in the ordered set where groupId = ? and displayDate < ?. * * @param groupId the group ID * @param displayDate the display date * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry fetchByG_LtD_First( long groupId, Date displayDate, OrderByComparator orderByComparator) { List list = findByG_LtD( groupId, displayDate, 0, 1, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the last blogs entry in the ordered set where groupId = ? and displayDate < ?. * * @param groupId the group ID * @param displayDate the display date * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByG_LtD_Last( long groupId, Date displayDate, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByG_LtD_Last( groupId, displayDate, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("groupId="); msg.append(groupId); msg.append(", displayDate="); msg.append(displayDate); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the last blogs entry in the ordered set where groupId = ? and displayDate < ?. * * @param groupId the group ID * @param displayDate the display date * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry fetchByG_LtD_Last( long groupId, Date displayDate, OrderByComparator orderByComparator) { int count = countByG_LtD(groupId, displayDate); if (count == 0) { return null; } List list = findByG_LtD( groupId, displayDate, count - 1, count, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the blogs entries before and after the current blogs entry in the ordered set where groupId = ? and displayDate < ?. * * @param entryId the primary key of the current blogs entry * @param groupId the group ID * @param displayDate the display date * @param orderByComparator the comparator to order the set by (optionally null) * @return the previous, current, and next blogs entry * @throws NoSuchEntryException if a blogs entry with the primary key could not be found */ @Override public BlogsEntry[] findByG_LtD_PrevAndNext( long entryId, long groupId, Date displayDate, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BlogsEntry[] array = new BlogsEntryImpl[3]; array[0] = getByG_LtD_PrevAndNext( session, blogsEntry, groupId, displayDate, orderByComparator, true); array[1] = blogsEntry; array[2] = getByG_LtD_PrevAndNext( session, blogsEntry, groupId, displayDate, orderByComparator, false); return array; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } protected BlogsEntry getByG_LtD_PrevAndNext( Session session, BlogsEntry blogsEntry, long groupId, Date displayDate, OrderByComparator orderByComparator, boolean previous) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 5 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(4); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_LTD_GROUPID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_LTD_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_LTD_DISPLAYDATE_2); } if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { query.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByConditionFields[i]); if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN_HAS_NEXT); } else { query.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN); } else { query.append(WHERE_LESSER_THAN); } } } query.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByFields[i]); if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC_HAS_NEXT); } else { query.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC); } else { query.append(ORDER_BY_DESC); } } } } else { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Query q = session.createQuery(sql); q.setFirstResult(0); q.setMaxResults(2); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues(blogsEntry)) { qPos.add(orderByConditionValue); } } List list = q.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Returns all the blogs entries that the user has permission to view where groupId = ? and displayDate < ?. * * @param groupId the group ID * @param displayDate the display date * @return the matching blogs entries that the user has permission to view */ @Override public List filterFindByG_LtD(long groupId, Date displayDate) { return filterFindByG_LtD( groupId, displayDate, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the blogs entries that the user has permission to view where groupId = ? and displayDate < ?. * *

* 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

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

* 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param displayDate the display date * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching blogs entries that the user has permission to view */ @Override public List filterFindByG_LtD( long groupId, Date displayDate, int start, int end, OrderByComparator orderByComparator) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByG_LtD( groupId, displayDate, start, end, orderByComparator); } StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 4 + (orderByComparator.getOrderByFields().length * 2)); } else { query = new StringBundler(5); } if (getDB().isSupportsInlineDistinct()) { query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE); } else { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1); } query.append(_FINDER_COLUMN_G_LTD_GROUPID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_LTD_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_LTD_DISPLAYDATE_2); } if (!getDB().isSupportsInlineDistinct()) { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { if (getDB().isSupportsInlineDistinct()) { appendOrderByComparator( query, _ORDER_BY_ENTITY_ALIAS, orderByComparator, true); } else { appendOrderByComparator( query, _ORDER_BY_ENTITY_TABLE, orderByComparator, true); } } else { if (getDB().isSupportsInlineDistinct()) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } else { query.append(BlogsEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck( query.toString(), BlogsEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery q = session.createSynchronizedSQLQuery(sql); if (getDB().isSupportsInlineDistinct()) { q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class); } else { q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class); } QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } return (List)QueryUtil.list( q, getDialect(), start, end); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } /** * Returns the blogs entries before and after the current blogs entry in the ordered set of blogs entries that the user has permission to view where groupId = ? and displayDate < ?. * * @param entryId the primary key of the current blogs entry * @param groupId the group ID * @param displayDate the display date * @param orderByComparator the comparator to order the set by (optionally null) * @return the previous, current, and next blogs entry * @throws NoSuchEntryException if a blogs entry with the primary key could not be found */ @Override public BlogsEntry[] filterFindByG_LtD_PrevAndNext( long entryId, long groupId, Date displayDate, OrderByComparator orderByComparator) throws NoSuchEntryException { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByG_LtD_PrevAndNext( entryId, groupId, displayDate, orderByComparator); } BlogsEntry blogsEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BlogsEntry[] array = new BlogsEntryImpl[3]; array[0] = filterGetByG_LtD_PrevAndNext( session, blogsEntry, groupId, displayDate, orderByComparator, true); array[1] = blogsEntry; array[2] = filterGetByG_LtD_PrevAndNext( session, blogsEntry, groupId, displayDate, orderByComparator, false); return array; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } protected BlogsEntry filterGetByG_LtD_PrevAndNext( Session session, BlogsEntry blogsEntry, long groupId, Date displayDate, OrderByComparator orderByComparator, boolean previous) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 6 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(5); } if (getDB().isSupportsInlineDistinct()) { query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE); } else { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1); } query.append(_FINDER_COLUMN_G_LTD_GROUPID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_LTD_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_LTD_DISPLAYDATE_2); } if (!getDB().isSupportsInlineDistinct()) { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { query.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { if (getDB().isSupportsInlineDistinct()) { query.append( getColumnName( _ORDER_BY_ENTITY_ALIAS, orderByConditionFields[i], true)); } else { query.append( getColumnName( _ORDER_BY_ENTITY_TABLE, orderByConditionFields[i], true)); } if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN_HAS_NEXT); } else { query.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN); } else { query.append(WHERE_LESSER_THAN); } } } query.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { if (getDB().isSupportsInlineDistinct()) { query.append( getColumnName( _ORDER_BY_ENTITY_ALIAS, orderByFields[i], true)); } else { query.append( getColumnName( _ORDER_BY_ENTITY_TABLE, orderByFields[i], true)); } if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC_HAS_NEXT); } else { query.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC); } else { query.append(ORDER_BY_DESC); } } } } else { if (getDB().isSupportsInlineDistinct()) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } else { query.append(BlogsEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck( query.toString(), BlogsEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); SQLQuery q = session.createSynchronizedSQLQuery(sql); q.setFirstResult(0); q.setMaxResults(2); if (getDB().isSupportsInlineDistinct()) { q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class); } else { q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class); } QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues(blogsEntry)) { qPos.add(orderByConditionValue); } } List list = q.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Removes all the blogs entries where groupId = ? and displayDate < ? from the database. * * @param groupId the group ID * @param displayDate the display date */ @Override public void removeByG_LtD(long groupId, Date displayDate) { for (BlogsEntry blogsEntry : findByG_LtD( groupId, displayDate, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(blogsEntry); } } /** * Returns the number of blogs entries where groupId = ? and displayDate < ?. * * @param groupId the group ID * @param displayDate the display date * @return the number of matching blogs entries */ @Override public int countByG_LtD(long groupId, Date displayDate) { FinderPath finderPath = _finderPathWithPaginationCountByG_LtD; Object[] finderArgs = new Object[] {groupId, _getTime(displayDate)}; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(3); query.append(_SQL_COUNT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_LTD_GROUPID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_LTD_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_LTD_DISPLAYDATE_2); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); } /** * Returns the number of blogs entries that the user has permission to view where groupId = ? and displayDate < ?. * * @param groupId the group ID * @param displayDate the display date * @return the number of matching blogs entries that the user has permission to view */ @Override public int filterCountByG_LtD(long groupId, Date displayDate) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return countByG_LtD(groupId, displayDate); } StringBundler query = new StringBundler(3); query.append(_FILTER_SQL_COUNT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_LTD_GROUPID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_LTD_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_LTD_DISPLAYDATE_2); } String sql = InlineSQLHelperUtil.replacePermissionCheck( query.toString(), BlogsEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery q = session.createSynchronizedSQLQuery(sql); q.addScalar( COUNT_COLUMN_NAME, com.liferay.portal.kernel.dao.orm.Type.LONG); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } Long count = (Long)q.uniqueResult(); return count.intValue(); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } private static final String _FINDER_COLUMN_G_LTD_GROUPID_2 = "blogsEntry.groupId = ? AND "; private static final String _FINDER_COLUMN_G_LTD_DISPLAYDATE_1 = "blogsEntry.displayDate IS NULL"; private static final String _FINDER_COLUMN_G_LTD_DISPLAYDATE_2 = "blogsEntry.displayDate < ?"; private FinderPath _finderPathWithPaginationFindByG_S; private FinderPath _finderPathWithoutPaginationFindByG_S; private FinderPath _finderPathCountByG_S; /** * Returns all the blogs entries where groupId = ? and status = ?. * * @param groupId the group ID * @param status the status * @return the matching blogs 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 blogs 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @return the range of matching blogs 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 blogs 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching blogs 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 blogs 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @param retrieveFromCache whether to retrieve from the finder cache * @return the ordered range of matching blogs entries */ @Override public List findByG_S( long groupId, int status, int start, int end, OrderByComparator orderByComparator, boolean retrieveFromCache) { boolean pagination = true; FinderPath finderPath = null; Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { pagination = false; finderPath = _finderPathWithoutPaginationFindByG_S; finderArgs = new Object[] {groupId, status}; } else { finderPath = _finderPathWithPaginationFindByG_S; finderArgs = new Object[] { groupId, status, start, end, orderByComparator }; } List list = null; if (retrieveFromCache) { list = (List)finderCache.getResult( finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (BlogsEntry blogsEntry : list) { if ((groupId != blogsEntry.getGroupId()) || (status != blogsEntry.getStatus())) { list = null; break; } } } } if (list == null) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 4 + (orderByComparator.getOrderByFields().length * 2)); } else { query = new StringBundler(4); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_S_GROUPID_2); query.append(_FINDER_COLUMN_G_S_STATUS_2); if (orderByComparator != null) { appendOrderByComparator( query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(status); if (!pagination) { list = (List)QueryUtil.list( q, getDialect(), start, end, false); Collections.sort(list); list = Collections.unmodifiableList(list); } else { list = (List)QueryUtil.list( q, getDialect(), start, end); } cacheResult(list); finderCache.putResult(finderPath, finderArgs, list); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; } /** * Returns the first blogs 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 blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByG_S_First( long groupId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByG_S_First( groupId, status, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("groupId="); msg.append(groupId); msg.append(", status="); msg.append(status); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the first blogs 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 blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry 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 blogs 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 blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByG_S_Last( long groupId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByG_S_Last( groupId, status, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("groupId="); msg.append(groupId); msg.append(", status="); msg.append(status); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the last blogs 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 blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry 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 blogs entries before and after the current blogs entry in the ordered set where groupId = ? and status = ?. * * @param entryId the primary key of the current blogs 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 blogs entry * @throws NoSuchEntryException if a blogs entry with the primary key could not be found */ @Override public BlogsEntry[] findByG_S_PrevAndNext( long entryId, long groupId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BlogsEntry[] array = new BlogsEntryImpl[3]; array[0] = getByG_S_PrevAndNext( session, blogsEntry, groupId, status, orderByComparator, true); array[1] = blogsEntry; array[2] = getByG_S_PrevAndNext( session, blogsEntry, groupId, status, orderByComparator, false); return array; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } protected BlogsEntry getByG_S_PrevAndNext( Session session, BlogsEntry blogsEntry, long groupId, int status, OrderByComparator orderByComparator, boolean previous) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 5 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(4); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_S_GROUPID_2); query.append(_FINDER_COLUMN_G_S_STATUS_2); if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { query.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByConditionFields[i]); if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN_HAS_NEXT); } else { query.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN); } else { query.append(WHERE_LESSER_THAN); } } } query.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByFields[i]); if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC_HAS_NEXT); } else { query.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC); } else { query.append(ORDER_BY_DESC); } } } } else { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Query q = session.createQuery(sql); q.setFirstResult(0); q.setMaxResults(2); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(status); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues(blogsEntry)) { qPos.add(orderByConditionValue); } } List list = q.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Returns all the blogs entries that the user has permission to view where groupId = ? and status = ?. * * @param groupId the group ID * @param status the status * @return the matching blogs 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 blogs 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @return the range of matching blogs 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 blogs 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching blogs 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 query = null; if (orderByComparator != null) { query = new StringBundler( 4 + (orderByComparator.getOrderByFields().length * 2)); } else { query = new StringBundler(5); } if (getDB().isSupportsInlineDistinct()) { query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE); } else { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1); } query.append(_FINDER_COLUMN_G_S_GROUPID_2); query.append(_FINDER_COLUMN_G_S_STATUS_2); if (!getDB().isSupportsInlineDistinct()) { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { if (getDB().isSupportsInlineDistinct()) { appendOrderByComparator( query, _ORDER_BY_ENTITY_ALIAS, orderByComparator, true); } else { appendOrderByComparator( query, _ORDER_BY_ENTITY_TABLE, orderByComparator, true); } } else { if (getDB().isSupportsInlineDistinct()) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } else { query.append(BlogsEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck( query.toString(), BlogsEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery q = session.createSynchronizedSQLQuery(sql); if (getDB().isSupportsInlineDistinct()) { q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class); } else { q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class); } QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(status); return (List)QueryUtil.list( q, getDialect(), start, end); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } /** * Returns the blogs entries before and after the current blogs entry in the ordered set of blogs entries that the user has permission to view where groupId = ? and status = ?. * * @param entryId the primary key of the current blogs 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 blogs entry * @throws NoSuchEntryException if a blogs entry with the primary key could not be found */ @Override public BlogsEntry[] 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); } BlogsEntry blogsEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BlogsEntry[] array = new BlogsEntryImpl[3]; array[0] = filterGetByG_S_PrevAndNext( session, blogsEntry, groupId, status, orderByComparator, true); array[1] = blogsEntry; array[2] = filterGetByG_S_PrevAndNext( session, blogsEntry, groupId, status, orderByComparator, false); return array; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } protected BlogsEntry filterGetByG_S_PrevAndNext( Session session, BlogsEntry blogsEntry, long groupId, int status, OrderByComparator orderByComparator, boolean previous) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 6 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(5); } if (getDB().isSupportsInlineDistinct()) { query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE); } else { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1); } query.append(_FINDER_COLUMN_G_S_GROUPID_2); query.append(_FINDER_COLUMN_G_S_STATUS_2); if (!getDB().isSupportsInlineDistinct()) { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { query.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { if (getDB().isSupportsInlineDistinct()) { query.append( getColumnName( _ORDER_BY_ENTITY_ALIAS, orderByConditionFields[i], true)); } else { query.append( getColumnName( _ORDER_BY_ENTITY_TABLE, orderByConditionFields[i], true)); } if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN_HAS_NEXT); } else { query.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN); } else { query.append(WHERE_LESSER_THAN); } } } query.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { if (getDB().isSupportsInlineDistinct()) { query.append( getColumnName( _ORDER_BY_ENTITY_ALIAS, orderByFields[i], true)); } else { query.append( getColumnName( _ORDER_BY_ENTITY_TABLE, orderByFields[i], true)); } if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC_HAS_NEXT); } else { query.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC); } else { query.append(ORDER_BY_DESC); } } } } else { if (getDB().isSupportsInlineDistinct()) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } else { query.append(BlogsEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck( query.toString(), BlogsEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); SQLQuery q = session.createSynchronizedSQLQuery(sql); q.setFirstResult(0); q.setMaxResults(2); if (getDB().isSupportsInlineDistinct()) { q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class); } else { q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class); } QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(status); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues(blogsEntry)) { qPos.add(orderByConditionValue); } } List list = q.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Removes all the blogs 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 (BlogsEntry blogsEntry : findByG_S( groupId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(blogsEntry); } } /** * Returns the number of blogs entries where groupId = ? and status = ?. * * @param groupId the group ID * @param status the status * @return the number of matching blogs entries */ @Override public int countByG_S(long groupId, int status) { FinderPath finderPath = _finderPathCountByG_S; Object[] finderArgs = new Object[] {groupId, status}; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(3); query.append(_SQL_COUNT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_S_GROUPID_2); query.append(_FINDER_COLUMN_G_S_STATUS_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(status); count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); } /** * Returns the number of blogs 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 blogs 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 query = new StringBundler(3); query.append(_FILTER_SQL_COUNT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_S_GROUPID_2); query.append(_FINDER_COLUMN_G_S_STATUS_2); String sql = InlineSQLHelperUtil.replacePermissionCheck( query.toString(), BlogsEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery q = session.createSynchronizedSQLQuery(sql); q.addScalar( COUNT_COLUMN_NAME, com.liferay.portal.kernel.dao.orm.Type.LONG); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(status); Long count = (Long)q.uniqueResult(); return count.intValue(); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } private static final String _FINDER_COLUMN_G_S_GROUPID_2 = "blogsEntry.groupId = ? AND "; private static final String _FINDER_COLUMN_G_S_STATUS_2 = "blogsEntry.status = ?"; private FinderPath _finderPathWithPaginationFindByG_NotS; private FinderPath _finderPathWithPaginationCountByG_NotS; /** * Returns all the blogs entries where groupId = ? and status ≠ ?. * * @param groupId the group ID * @param status the status * @return the matching blogs 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 blogs 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @return the range of matching blogs 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 blogs 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching blogs 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 blogs 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @param retrieveFromCache whether to retrieve from the finder cache * @return the ordered range of matching blogs entries */ @Override public List findByG_NotS( long groupId, int status, int start, int end, OrderByComparator orderByComparator, boolean retrieveFromCache) { boolean pagination = true; FinderPath finderPath = null; Object[] finderArgs = null; finderPath = _finderPathWithPaginationFindByG_NotS; finderArgs = new Object[] { groupId, status, start, end, orderByComparator }; List list = null; if (retrieveFromCache) { list = (List)finderCache.getResult( finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (BlogsEntry blogsEntry : list) { if ((groupId != blogsEntry.getGroupId()) || (status == blogsEntry.getStatus())) { list = null; break; } } } } if (list == null) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 4 + (orderByComparator.getOrderByFields().length * 2)); } else { query = new StringBundler(4); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_NOTS_GROUPID_2); query.append(_FINDER_COLUMN_G_NOTS_STATUS_2); if (orderByComparator != null) { appendOrderByComparator( query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(status); if (!pagination) { list = (List)QueryUtil.list( q, getDialect(), start, end, false); Collections.sort(list); list = Collections.unmodifiableList(list); } else { list = (List)QueryUtil.list( q, getDialect(), start, end); } cacheResult(list); finderCache.putResult(finderPath, finderArgs, list); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; } /** * Returns the first blogs 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 blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByG_NotS_First( long groupId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByG_NotS_First( groupId, status, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("groupId="); msg.append(groupId); msg.append(", status="); msg.append(status); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the first blogs 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 blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry 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 blogs 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 blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByG_NotS_Last( long groupId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByG_NotS_Last( groupId, status, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("groupId="); msg.append(groupId); msg.append(", status="); msg.append(status); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the last blogs 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 blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry 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 blogs entries before and after the current blogs entry in the ordered set where groupId = ? and status ≠ ?. * * @param entryId the primary key of the current blogs 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 blogs entry * @throws NoSuchEntryException if a blogs entry with the primary key could not be found */ @Override public BlogsEntry[] findByG_NotS_PrevAndNext( long entryId, long groupId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BlogsEntry[] array = new BlogsEntryImpl[3]; array[0] = getByG_NotS_PrevAndNext( session, blogsEntry, groupId, status, orderByComparator, true); array[1] = blogsEntry; array[2] = getByG_NotS_PrevAndNext( session, blogsEntry, groupId, status, orderByComparator, false); return array; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } protected BlogsEntry getByG_NotS_PrevAndNext( Session session, BlogsEntry blogsEntry, long groupId, int status, OrderByComparator orderByComparator, boolean previous) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 5 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(4); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_NOTS_GROUPID_2); query.append(_FINDER_COLUMN_G_NOTS_STATUS_2); if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { query.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByConditionFields[i]); if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN_HAS_NEXT); } else { query.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN); } else { query.append(WHERE_LESSER_THAN); } } } query.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByFields[i]); if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC_HAS_NEXT); } else { query.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC); } else { query.append(ORDER_BY_DESC); } } } } else { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Query q = session.createQuery(sql); q.setFirstResult(0); q.setMaxResults(2); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(status); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues(blogsEntry)) { qPos.add(orderByConditionValue); } } List list = q.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Returns all the blogs entries that the user has permission to view where groupId = ? and status ≠ ?. * * @param groupId the group ID * @param status the status * @return the matching blogs 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 blogs 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @return the range of matching blogs 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 blogs 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching blogs 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 query = null; if (orderByComparator != null) { query = new StringBundler( 4 + (orderByComparator.getOrderByFields().length * 2)); } else { query = new StringBundler(5); } if (getDB().isSupportsInlineDistinct()) { query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE); } else { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1); } query.append(_FINDER_COLUMN_G_NOTS_GROUPID_2); query.append(_FINDER_COLUMN_G_NOTS_STATUS_2); if (!getDB().isSupportsInlineDistinct()) { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { if (getDB().isSupportsInlineDistinct()) { appendOrderByComparator( query, _ORDER_BY_ENTITY_ALIAS, orderByComparator, true); } else { appendOrderByComparator( query, _ORDER_BY_ENTITY_TABLE, orderByComparator, true); } } else { if (getDB().isSupportsInlineDistinct()) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } else { query.append(BlogsEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck( query.toString(), BlogsEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery q = session.createSynchronizedSQLQuery(sql); if (getDB().isSupportsInlineDistinct()) { q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class); } else { q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class); } QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(status); return (List)QueryUtil.list( q, getDialect(), start, end); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } /** * Returns the blogs entries before and after the current blogs entry in the ordered set of blogs entries that the user has permission to view where groupId = ? and status ≠ ?. * * @param entryId the primary key of the current blogs 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 blogs entry * @throws NoSuchEntryException if a blogs entry with the primary key could not be found */ @Override public BlogsEntry[] 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); } BlogsEntry blogsEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BlogsEntry[] array = new BlogsEntryImpl[3]; array[0] = filterGetByG_NotS_PrevAndNext( session, blogsEntry, groupId, status, orderByComparator, true); array[1] = blogsEntry; array[2] = filterGetByG_NotS_PrevAndNext( session, blogsEntry, groupId, status, orderByComparator, false); return array; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } protected BlogsEntry filterGetByG_NotS_PrevAndNext( Session session, BlogsEntry blogsEntry, long groupId, int status, OrderByComparator orderByComparator, boolean previous) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 6 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(5); } if (getDB().isSupportsInlineDistinct()) { query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE); } else { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1); } query.append(_FINDER_COLUMN_G_NOTS_GROUPID_2); query.append(_FINDER_COLUMN_G_NOTS_STATUS_2); if (!getDB().isSupportsInlineDistinct()) { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { query.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { if (getDB().isSupportsInlineDistinct()) { query.append( getColumnName( _ORDER_BY_ENTITY_ALIAS, orderByConditionFields[i], true)); } else { query.append( getColumnName( _ORDER_BY_ENTITY_TABLE, orderByConditionFields[i], true)); } if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN_HAS_NEXT); } else { query.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN); } else { query.append(WHERE_LESSER_THAN); } } } query.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { if (getDB().isSupportsInlineDistinct()) { query.append( getColumnName( _ORDER_BY_ENTITY_ALIAS, orderByFields[i], true)); } else { query.append( getColumnName( _ORDER_BY_ENTITY_TABLE, orderByFields[i], true)); } if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC_HAS_NEXT); } else { query.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC); } else { query.append(ORDER_BY_DESC); } } } } else { if (getDB().isSupportsInlineDistinct()) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } else { query.append(BlogsEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck( query.toString(), BlogsEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); SQLQuery q = session.createSynchronizedSQLQuery(sql); q.setFirstResult(0); q.setMaxResults(2); if (getDB().isSupportsInlineDistinct()) { q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class); } else { q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class); } QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(status); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues(blogsEntry)) { qPos.add(orderByConditionValue); } } List list = q.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Removes all the blogs 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 (BlogsEntry blogsEntry : findByG_NotS( groupId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(blogsEntry); } } /** * Returns the number of blogs entries where groupId = ? and status ≠ ?. * * @param groupId the group ID * @param status the status * @return the number of matching blogs entries */ @Override public int countByG_NotS(long groupId, int status) { FinderPath finderPath = _finderPathWithPaginationCountByG_NotS; Object[] finderArgs = new Object[] {groupId, status}; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(3); query.append(_SQL_COUNT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_NOTS_GROUPID_2); query.append(_FINDER_COLUMN_G_NOTS_STATUS_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(status); count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); } /** * Returns the number of blogs 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 blogs 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 query = new StringBundler(3); query.append(_FILTER_SQL_COUNT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_NOTS_GROUPID_2); query.append(_FINDER_COLUMN_G_NOTS_STATUS_2); String sql = InlineSQLHelperUtil.replacePermissionCheck( query.toString(), BlogsEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery q = session.createSynchronizedSQLQuery(sql); q.addScalar( COUNT_COLUMN_NAME, com.liferay.portal.kernel.dao.orm.Type.LONG); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(status); Long count = (Long)q.uniqueResult(); return count.intValue(); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } private static final String _FINDER_COLUMN_G_NOTS_GROUPID_2 = "blogsEntry.groupId = ? AND "; private static final String _FINDER_COLUMN_G_NOTS_STATUS_2 = "blogsEntry.status != ?"; private FinderPath _finderPathWithPaginationFindByC_U; private FinderPath _finderPathWithoutPaginationFindByC_U; private FinderPath _finderPathCountByC_U; /** * Returns all the blogs entries where companyId = ? and userId = ?. * * @param companyId the company ID * @param userId the user ID * @return the matching blogs entries */ @Override public List findByC_U(long companyId, long userId) { return findByC_U( companyId, userId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the blogs entries where companyId = ? and userId = ?. * *

* 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

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

* 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

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

* 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param companyId the company ID * @param userId the user ID * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @param retrieveFromCache whether to retrieve from the finder cache * @return the ordered range of matching blogs entries */ @Override public List findByC_U( long companyId, long userId, int start, int end, OrderByComparator orderByComparator, boolean retrieveFromCache) { boolean pagination = true; FinderPath finderPath = null; Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { pagination = false; finderPath = _finderPathWithoutPaginationFindByC_U; finderArgs = new Object[] {companyId, userId}; } else { finderPath = _finderPathWithPaginationFindByC_U; finderArgs = new Object[] { companyId, userId, start, end, orderByComparator }; } List list = null; if (retrieveFromCache) { list = (List)finderCache.getResult( finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (BlogsEntry blogsEntry : list) { if ((companyId != blogsEntry.getCompanyId()) || (userId != blogsEntry.getUserId())) { list = null; break; } } } } if (list == null) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 4 + (orderByComparator.getOrderByFields().length * 2)); } else { query = new StringBundler(4); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_C_U_COMPANYID_2); query.append(_FINDER_COLUMN_C_U_USERID_2); if (orderByComparator != null) { appendOrderByComparator( query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(companyId); qPos.add(userId); if (!pagination) { list = (List)QueryUtil.list( q, getDialect(), start, end, false); Collections.sort(list); list = Collections.unmodifiableList(list); } else { list = (List)QueryUtil.list( q, getDialect(), start, end); } cacheResult(list); finderCache.putResult(finderPath, finderArgs, list); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; } /** * Returns the first blogs entry in the ordered set where companyId = ? and userId = ?. * * @param companyId the company ID * @param userId the user ID * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByC_U_First( long companyId, long userId, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByC_U_First( companyId, userId, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("companyId="); msg.append(companyId); msg.append(", userId="); msg.append(userId); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the first blogs entry in the ordered set where companyId = ? and userId = ?. * * @param companyId the company ID * @param userId the user ID * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry fetchByC_U_First( long companyId, long userId, OrderByComparator orderByComparator) { List list = findByC_U( companyId, userId, 0, 1, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the last blogs entry in the ordered set where companyId = ? and userId = ?. * * @param companyId the company ID * @param userId the user ID * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByC_U_Last( long companyId, long userId, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByC_U_Last( companyId, userId, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("companyId="); msg.append(companyId); msg.append(", userId="); msg.append(userId); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the last blogs entry in the ordered set where companyId = ? and userId = ?. * * @param companyId the company ID * @param userId the user ID * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry fetchByC_U_Last( long companyId, long userId, OrderByComparator orderByComparator) { int count = countByC_U(companyId, userId); if (count == 0) { return null; } List list = findByC_U( companyId, userId, count - 1, count, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the blogs entries before and after the current blogs entry in the ordered set where companyId = ? and userId = ?. * * @param entryId the primary key of the current blogs entry * @param companyId the company ID * @param userId the user ID * @param orderByComparator the comparator to order the set by (optionally null) * @return the previous, current, and next blogs entry * @throws NoSuchEntryException if a blogs entry with the primary key could not be found */ @Override public BlogsEntry[] findByC_U_PrevAndNext( long entryId, long companyId, long userId, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BlogsEntry[] array = new BlogsEntryImpl[3]; array[0] = getByC_U_PrevAndNext( session, blogsEntry, companyId, userId, orderByComparator, true); array[1] = blogsEntry; array[2] = getByC_U_PrevAndNext( session, blogsEntry, companyId, userId, orderByComparator, false); return array; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } protected BlogsEntry getByC_U_PrevAndNext( Session session, BlogsEntry blogsEntry, long companyId, long userId, OrderByComparator orderByComparator, boolean previous) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 5 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(4); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_C_U_COMPANYID_2); query.append(_FINDER_COLUMN_C_U_USERID_2); if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { query.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByConditionFields[i]); if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN_HAS_NEXT); } else { query.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN); } else { query.append(WHERE_LESSER_THAN); } } } query.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByFields[i]); if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC_HAS_NEXT); } else { query.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC); } else { query.append(ORDER_BY_DESC); } } } } else { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Query q = session.createQuery(sql); q.setFirstResult(0); q.setMaxResults(2); QueryPos qPos = QueryPos.getInstance(q); qPos.add(companyId); qPos.add(userId); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues(blogsEntry)) { qPos.add(orderByConditionValue); } } List list = q.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Removes all the blogs entries where companyId = ? and userId = ? from the database. * * @param companyId the company ID * @param userId the user ID */ @Override public void removeByC_U(long companyId, long userId) { for (BlogsEntry blogsEntry : findByC_U( companyId, userId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(blogsEntry); } } /** * Returns the number of blogs entries where companyId = ? and userId = ?. * * @param companyId the company ID * @param userId the user ID * @return the number of matching blogs entries */ @Override public int countByC_U(long companyId, long userId) { FinderPath finderPath = _finderPathCountByC_U; Object[] finderArgs = new Object[] {companyId, userId}; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(3); query.append(_SQL_COUNT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_C_U_COMPANYID_2); query.append(_FINDER_COLUMN_C_U_USERID_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(companyId); qPos.add(userId); count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); } private static final String _FINDER_COLUMN_C_U_COMPANYID_2 = "blogsEntry.companyId = ? AND "; private static final String _FINDER_COLUMN_C_U_USERID_2 = "blogsEntry.userId = ?"; private FinderPath _finderPathWithPaginationFindByC_LtD; private FinderPath _finderPathWithPaginationCountByC_LtD; /** * Returns all the blogs entries where companyId = ? and displayDate < ?. * * @param companyId the company ID * @param displayDate the display date * @return the matching blogs entries */ @Override public List findByC_LtD(long companyId, Date displayDate) { return findByC_LtD( companyId, displayDate, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the blogs entries where companyId = ? and displayDate < ?. * *

* 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

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

* 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

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

* 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param companyId the company ID * @param displayDate the display date * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @param retrieveFromCache whether to retrieve from the finder cache * @return the ordered range of matching blogs entries */ @Override public List findByC_LtD( long companyId, Date displayDate, int start, int end, OrderByComparator orderByComparator, boolean retrieveFromCache) { boolean pagination = true; FinderPath finderPath = null; Object[] finderArgs = null; finderPath = _finderPathWithPaginationFindByC_LtD; finderArgs = new Object[] { companyId, _getTime(displayDate), start, end, orderByComparator }; List list = null; if (retrieveFromCache) { list = (List)finderCache.getResult( finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (BlogsEntry blogsEntry : list) { if ((companyId != blogsEntry.getCompanyId()) || (displayDate.getTime() <= blogsEntry.getDisplayDate().getTime())) { list = null; break; } } } } if (list == null) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 4 + (orderByComparator.getOrderByFields().length * 2)); } else { query = new StringBundler(4); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_C_LTD_COMPANYID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_C_LTD_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_C_LTD_DISPLAYDATE_2); } if (orderByComparator != null) { appendOrderByComparator( query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(companyId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } if (!pagination) { list = (List)QueryUtil.list( q, getDialect(), start, end, false); Collections.sort(list); list = Collections.unmodifiableList(list); } else { list = (List)QueryUtil.list( q, getDialect(), start, end); } cacheResult(list); finderCache.putResult(finderPath, finderArgs, list); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; } /** * Returns the first blogs entry in the ordered set where companyId = ? and displayDate < ?. * * @param companyId the company ID * @param displayDate the display date * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByC_LtD_First( long companyId, Date displayDate, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByC_LtD_First( companyId, displayDate, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("companyId="); msg.append(companyId); msg.append(", displayDate="); msg.append(displayDate); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the first blogs entry in the ordered set where companyId = ? and displayDate < ?. * * @param companyId the company ID * @param displayDate the display date * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry fetchByC_LtD_First( long companyId, Date displayDate, OrderByComparator orderByComparator) { List list = findByC_LtD( companyId, displayDate, 0, 1, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the last blogs entry in the ordered set where companyId = ? and displayDate < ?. * * @param companyId the company ID * @param displayDate the display date * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByC_LtD_Last( long companyId, Date displayDate, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByC_LtD_Last( companyId, displayDate, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("companyId="); msg.append(companyId); msg.append(", displayDate="); msg.append(displayDate); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the last blogs entry in the ordered set where companyId = ? and displayDate < ?. * * @param companyId the company ID * @param displayDate the display date * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry fetchByC_LtD_Last( long companyId, Date displayDate, OrderByComparator orderByComparator) { int count = countByC_LtD(companyId, displayDate); if (count == 0) { return null; } List list = findByC_LtD( companyId, displayDate, count - 1, count, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the blogs entries before and after the current blogs entry in the ordered set where companyId = ? and displayDate < ?. * * @param entryId the primary key of the current blogs entry * @param companyId the company ID * @param displayDate the display date * @param orderByComparator the comparator to order the set by (optionally null) * @return the previous, current, and next blogs entry * @throws NoSuchEntryException if a blogs entry with the primary key could not be found */ @Override public BlogsEntry[] findByC_LtD_PrevAndNext( long entryId, long companyId, Date displayDate, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BlogsEntry[] array = new BlogsEntryImpl[3]; array[0] = getByC_LtD_PrevAndNext( session, blogsEntry, companyId, displayDate, orderByComparator, true); array[1] = blogsEntry; array[2] = getByC_LtD_PrevAndNext( session, blogsEntry, companyId, displayDate, orderByComparator, false); return array; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } protected BlogsEntry getByC_LtD_PrevAndNext( Session session, BlogsEntry blogsEntry, long companyId, Date displayDate, OrderByComparator orderByComparator, boolean previous) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 5 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(4); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_C_LTD_COMPANYID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_C_LTD_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_C_LTD_DISPLAYDATE_2); } if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { query.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByConditionFields[i]); if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN_HAS_NEXT); } else { query.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN); } else { query.append(WHERE_LESSER_THAN); } } } query.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByFields[i]); if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC_HAS_NEXT); } else { query.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC); } else { query.append(ORDER_BY_DESC); } } } } else { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Query q = session.createQuery(sql); q.setFirstResult(0); q.setMaxResults(2); QueryPos qPos = QueryPos.getInstance(q); qPos.add(companyId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues(blogsEntry)) { qPos.add(orderByConditionValue); } } List list = q.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Removes all the blogs entries where companyId = ? and displayDate < ? from the database. * * @param companyId the company ID * @param displayDate the display date */ @Override public void removeByC_LtD(long companyId, Date displayDate) { for (BlogsEntry blogsEntry : findByC_LtD( companyId, displayDate, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(blogsEntry); } } /** * Returns the number of blogs entries where companyId = ? and displayDate < ?. * * @param companyId the company ID * @param displayDate the display date * @return the number of matching blogs entries */ @Override public int countByC_LtD(long companyId, Date displayDate) { FinderPath finderPath = _finderPathWithPaginationCountByC_LtD; Object[] finderArgs = new Object[] {companyId, _getTime(displayDate)}; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(3); query.append(_SQL_COUNT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_C_LTD_COMPANYID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_C_LTD_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_C_LTD_DISPLAYDATE_2); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(companyId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); } private static final String _FINDER_COLUMN_C_LTD_COMPANYID_2 = "blogsEntry.companyId = ? AND "; private static final String _FINDER_COLUMN_C_LTD_DISPLAYDATE_1 = "blogsEntry.displayDate IS NULL"; private static final String _FINDER_COLUMN_C_LTD_DISPLAYDATE_2 = "blogsEntry.displayDate < ?"; private FinderPath _finderPathWithPaginationFindByC_S; private FinderPath _finderPathWithoutPaginationFindByC_S; private FinderPath _finderPathCountByC_S; /** * Returns all the blogs entries where companyId = ? and status = ?. * * @param companyId the company ID * @param status the status * @return the matching blogs entries */ @Override public List findByC_S(long companyId, int status) { return findByC_S( companyId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the blogs 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param companyId the company ID * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @return the range of matching blogs entries */ @Override public List findByC_S( long companyId, int status, int start, int end) { return findByC_S(companyId, status, start, end, null); } /** * Returns an ordered range of all the blogs 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param companyId the company ID * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching blogs entries */ @Override public List findByC_S( long companyId, int status, int start, int end, OrderByComparator orderByComparator) { return findByC_S( companyId, status, start, end, orderByComparator, true); } /** * Returns an ordered range of all the blogs 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param companyId the company ID * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @param retrieveFromCache whether to retrieve from the finder cache * @return the ordered range of matching blogs entries */ @Override public List findByC_S( long companyId, int status, int start, int end, OrderByComparator orderByComparator, boolean retrieveFromCache) { boolean pagination = true; FinderPath finderPath = null; Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { pagination = false; finderPath = _finderPathWithoutPaginationFindByC_S; finderArgs = new Object[] {companyId, status}; } else { finderPath = _finderPathWithPaginationFindByC_S; finderArgs = new Object[] { companyId, status, start, end, orderByComparator }; } List list = null; if (retrieveFromCache) { list = (List)finderCache.getResult( finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (BlogsEntry blogsEntry : list) { if ((companyId != blogsEntry.getCompanyId()) || (status != blogsEntry.getStatus())) { list = null; break; } } } } if (list == null) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 4 + (orderByComparator.getOrderByFields().length * 2)); } else { query = new StringBundler(4); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_C_S_COMPANYID_2); query.append(_FINDER_COLUMN_C_S_STATUS_2); if (orderByComparator != null) { appendOrderByComparator( query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(companyId); qPos.add(status); if (!pagination) { list = (List)QueryUtil.list( q, getDialect(), start, end, false); Collections.sort(list); list = Collections.unmodifiableList(list); } else { list = (List)QueryUtil.list( q, getDialect(), start, end); } cacheResult(list); finderCache.putResult(finderPath, finderArgs, list); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; } /** * Returns the first blogs 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 blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByC_S_First( long companyId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByC_S_First( companyId, status, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("companyId="); msg.append(companyId); msg.append(", status="); msg.append(status); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the first blogs 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 blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry fetchByC_S_First( long companyId, int status, OrderByComparator orderByComparator) { List list = findByC_S( companyId, status, 0, 1, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the last blogs 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 blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByC_S_Last( long companyId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByC_S_Last( companyId, status, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("companyId="); msg.append(companyId); msg.append(", status="); msg.append(status); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the last blogs 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 blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry fetchByC_S_Last( long companyId, int status, OrderByComparator orderByComparator) { int count = countByC_S(companyId, status); if (count == 0) { return null; } List list = findByC_S( companyId, status, count - 1, count, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the blogs entries before and after the current blogs entry in the ordered set where companyId = ? and status = ?. * * @param entryId the primary key of the current blogs 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 blogs entry * @throws NoSuchEntryException if a blogs entry with the primary key could not be found */ @Override public BlogsEntry[] findByC_S_PrevAndNext( long entryId, long companyId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BlogsEntry[] array = new BlogsEntryImpl[3]; array[0] = getByC_S_PrevAndNext( session, blogsEntry, companyId, status, orderByComparator, true); array[1] = blogsEntry; array[2] = getByC_S_PrevAndNext( session, blogsEntry, companyId, status, orderByComparator, false); return array; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } protected BlogsEntry getByC_S_PrevAndNext( Session session, BlogsEntry blogsEntry, long companyId, int status, OrderByComparator orderByComparator, boolean previous) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 5 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(4); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_C_S_COMPANYID_2); query.append(_FINDER_COLUMN_C_S_STATUS_2); if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { query.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByConditionFields[i]); if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN_HAS_NEXT); } else { query.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN); } else { query.append(WHERE_LESSER_THAN); } } } query.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByFields[i]); if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC_HAS_NEXT); } else { query.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC); } else { query.append(ORDER_BY_DESC); } } } } else { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Query q = session.createQuery(sql); q.setFirstResult(0); q.setMaxResults(2); QueryPos qPos = QueryPos.getInstance(q); qPos.add(companyId); qPos.add(status); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues(blogsEntry)) { qPos.add(orderByConditionValue); } } List list = q.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Removes all the blogs entries where companyId = ? and status = ? from the database. * * @param companyId the company ID * @param status the status */ @Override public void removeByC_S(long companyId, int status) { for (BlogsEntry blogsEntry : findByC_S( companyId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(blogsEntry); } } /** * Returns the number of blogs entries where companyId = ? and status = ?. * * @param companyId the company ID * @param status the status * @return the number of matching blogs entries */ @Override public int countByC_S(long companyId, int status) { FinderPath finderPath = _finderPathCountByC_S; Object[] finderArgs = new Object[] {companyId, status}; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(3); query.append(_SQL_COUNT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_C_S_COMPANYID_2); query.append(_FINDER_COLUMN_C_S_STATUS_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(companyId); qPos.add(status); count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); } private static final String _FINDER_COLUMN_C_S_COMPANYID_2 = "blogsEntry.companyId = ? AND "; private static final String _FINDER_COLUMN_C_S_STATUS_2 = "blogsEntry.status = ?"; private FinderPath _finderPathWithPaginationFindByC_NotS; private FinderPath _finderPathWithPaginationCountByC_NotS; /** * Returns all the blogs entries where companyId = ? and status ≠ ?. * * @param companyId the company ID * @param status the status * @return the matching blogs 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 blogs 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param companyId the company ID * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @return the range of matching blogs 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 blogs 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param companyId the company ID * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching blogs 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 blogs 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param companyId the company ID * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @param retrieveFromCache whether to retrieve from the finder cache * @return the ordered range of matching blogs entries */ @Override public List findByC_NotS( long companyId, int status, int start, int end, OrderByComparator orderByComparator, boolean retrieveFromCache) { boolean pagination = true; FinderPath finderPath = null; Object[] finderArgs = null; finderPath = _finderPathWithPaginationFindByC_NotS; finderArgs = new Object[] { companyId, status, start, end, orderByComparator }; List list = null; if (retrieveFromCache) { list = (List)finderCache.getResult( finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (BlogsEntry blogsEntry : list) { if ((companyId != blogsEntry.getCompanyId()) || (status == blogsEntry.getStatus())) { list = null; break; } } } } if (list == null) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 4 + (orderByComparator.getOrderByFields().length * 2)); } else { query = new StringBundler(4); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_C_NOTS_COMPANYID_2); query.append(_FINDER_COLUMN_C_NOTS_STATUS_2); if (orderByComparator != null) { appendOrderByComparator( query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(companyId); qPos.add(status); if (!pagination) { list = (List)QueryUtil.list( q, getDialect(), start, end, false); Collections.sort(list); list = Collections.unmodifiableList(list); } else { list = (List)QueryUtil.list( q, getDialect(), start, end); } cacheResult(list); finderCache.putResult(finderPath, finderArgs, list); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; } /** * Returns the first blogs 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 blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByC_NotS_First( long companyId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByC_NotS_First( companyId, status, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("companyId="); msg.append(companyId); msg.append(", status="); msg.append(status); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the first blogs 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 blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry 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 blogs 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 blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByC_NotS_Last( long companyId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByC_NotS_Last( companyId, status, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("companyId="); msg.append(companyId); msg.append(", status="); msg.append(status); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the last blogs 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 blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry 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 blogs entries before and after the current blogs entry in the ordered set where companyId = ? and status ≠ ?. * * @param entryId the primary key of the current blogs 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 blogs entry * @throws NoSuchEntryException if a blogs entry with the primary key could not be found */ @Override public BlogsEntry[] findByC_NotS_PrevAndNext( long entryId, long companyId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BlogsEntry[] array = new BlogsEntryImpl[3]; array[0] = getByC_NotS_PrevAndNext( session, blogsEntry, companyId, status, orderByComparator, true); array[1] = blogsEntry; array[2] = getByC_NotS_PrevAndNext( session, blogsEntry, companyId, status, orderByComparator, false); return array; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } protected BlogsEntry getByC_NotS_PrevAndNext( Session session, BlogsEntry blogsEntry, long companyId, int status, OrderByComparator orderByComparator, boolean previous) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 5 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(4); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_C_NOTS_COMPANYID_2); query.append(_FINDER_COLUMN_C_NOTS_STATUS_2); if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { query.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByConditionFields[i]); if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN_HAS_NEXT); } else { query.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN); } else { query.append(WHERE_LESSER_THAN); } } } query.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByFields[i]); if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC_HAS_NEXT); } else { query.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC); } else { query.append(ORDER_BY_DESC); } } } } else { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Query q = session.createQuery(sql); q.setFirstResult(0); q.setMaxResults(2); QueryPos qPos = QueryPos.getInstance(q); qPos.add(companyId); qPos.add(status); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues(blogsEntry)) { qPos.add(orderByConditionValue); } } List list = q.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Removes all the blogs 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 (BlogsEntry blogsEntry : findByC_NotS( companyId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(blogsEntry); } } /** * Returns the number of blogs entries where companyId = ? and status ≠ ?. * * @param companyId the company ID * @param status the status * @return the number of matching blogs entries */ @Override public int countByC_NotS(long companyId, int status) { FinderPath finderPath = _finderPathWithPaginationCountByC_NotS; Object[] finderArgs = new Object[] {companyId, status}; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(3); query.append(_SQL_COUNT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_C_NOTS_COMPANYID_2); query.append(_FINDER_COLUMN_C_NOTS_STATUS_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(companyId); qPos.add(status); count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); } private static final String _FINDER_COLUMN_C_NOTS_COMPANYID_2 = "blogsEntry.companyId = ? AND "; private static final String _FINDER_COLUMN_C_NOTS_STATUS_2 = "blogsEntry.status != ?"; private FinderPath _finderPathWithPaginationFindByLtD_S; private FinderPath _finderPathWithPaginationCountByLtD_S; /** * Returns all the blogs entries where displayDate < ? and status = ?. * * @param displayDate the display date * @param status the status * @return the matching blogs entries */ @Override public List findByLtD_S(Date displayDate, int status) { return findByLtD_S( displayDate, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the blogs entries where displayDate < ? 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param displayDate the display date * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @return the range of matching blogs entries */ @Override public List findByLtD_S( Date displayDate, int status, int start, int end) { return findByLtD_S(displayDate, status, start, end, null); } /** * Returns an ordered range of all the blogs entries where displayDate < ? 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param displayDate the display date * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching blogs entries */ @Override public List findByLtD_S( Date displayDate, int status, int start, int end, OrderByComparator orderByComparator) { return findByLtD_S( displayDate, status, start, end, orderByComparator, true); } /** * Returns an ordered range of all the blogs entries where displayDate < ? 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param displayDate the display date * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @param retrieveFromCache whether to retrieve from the finder cache * @return the ordered range of matching blogs entries */ @Override public List findByLtD_S( Date displayDate, int status, int start, int end, OrderByComparator orderByComparator, boolean retrieveFromCache) { boolean pagination = true; FinderPath finderPath = null; Object[] finderArgs = null; finderPath = _finderPathWithPaginationFindByLtD_S; finderArgs = new Object[] { _getTime(displayDate), status, start, end, orderByComparator }; List list = null; if (retrieveFromCache) { list = (List)finderCache.getResult( finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (BlogsEntry blogsEntry : list) { if ((displayDate.getTime() <= blogsEntry.getDisplayDate().getTime()) || (status != blogsEntry.getStatus())) { list = null; break; } } } } if (list == null) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 4 + (orderByComparator.getOrderByFields().length * 2)); } else { query = new StringBundler(4); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_LTD_S_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_LTD_S_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_LTD_S_STATUS_2); if (orderByComparator != null) { appendOrderByComparator( query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); if (!pagination) { list = (List)QueryUtil.list( q, getDialect(), start, end, false); Collections.sort(list); list = Collections.unmodifiableList(list); } else { list = (List)QueryUtil.list( q, getDialect(), start, end); } cacheResult(list); finderCache.putResult(finderPath, finderArgs, list); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; } /** * Returns the first blogs entry in the ordered set where displayDate < ? and status = ?. * * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByLtD_S_First( Date displayDate, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByLtD_S_First( displayDate, status, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("displayDate="); msg.append(displayDate); msg.append(", status="); msg.append(status); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the first blogs entry in the ordered set where displayDate < ? and status = ?. * * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry fetchByLtD_S_First( Date displayDate, int status, OrderByComparator orderByComparator) { List list = findByLtD_S( displayDate, status, 0, 1, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the last blogs entry in the ordered set where displayDate < ? and status = ?. * * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByLtD_S_Last( Date displayDate, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByLtD_S_Last( displayDate, status, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(6); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("displayDate="); msg.append(displayDate); msg.append(", status="); msg.append(status); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the last blogs entry in the ordered set where displayDate < ? and status = ?. * * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry fetchByLtD_S_Last( Date displayDate, int status, OrderByComparator orderByComparator) { int count = countByLtD_S(displayDate, status); if (count == 0) { return null; } List list = findByLtD_S( displayDate, status, count - 1, count, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the blogs entries before and after the current blogs entry in the ordered set where displayDate < ? and status = ?. * * @param entryId the primary key of the current blogs entry * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the previous, current, and next blogs entry * @throws NoSuchEntryException if a blogs entry with the primary key could not be found */ @Override public BlogsEntry[] findByLtD_S_PrevAndNext( long entryId, Date displayDate, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BlogsEntry[] array = new BlogsEntryImpl[3]; array[0] = getByLtD_S_PrevAndNext( session, blogsEntry, displayDate, status, orderByComparator, true); array[1] = blogsEntry; array[2] = getByLtD_S_PrevAndNext( session, blogsEntry, displayDate, status, orderByComparator, false); return array; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } protected BlogsEntry getByLtD_S_PrevAndNext( Session session, BlogsEntry blogsEntry, Date displayDate, int status, OrderByComparator orderByComparator, boolean previous) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 5 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(4); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_LTD_S_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_LTD_S_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_LTD_S_STATUS_2); if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { query.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByConditionFields[i]); if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN_HAS_NEXT); } else { query.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN); } else { query.append(WHERE_LESSER_THAN); } } } query.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByFields[i]); if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC_HAS_NEXT); } else { query.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC); } else { query.append(ORDER_BY_DESC); } } } } else { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Query q = session.createQuery(sql); q.setFirstResult(0); q.setMaxResults(2); QueryPos qPos = QueryPos.getInstance(q); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues(blogsEntry)) { qPos.add(orderByConditionValue); } } List list = q.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Removes all the blogs entries where displayDate < ? and status = ? from the database. * * @param displayDate the display date * @param status the status */ @Override public void removeByLtD_S(Date displayDate, int status) { for (BlogsEntry blogsEntry : findByLtD_S( displayDate, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(blogsEntry); } } /** * Returns the number of blogs entries where displayDate < ? and status = ?. * * @param displayDate the display date * @param status the status * @return the number of matching blogs entries */ @Override public int countByLtD_S(Date displayDate, int status) { FinderPath finderPath = _finderPathWithPaginationCountByLtD_S; Object[] finderArgs = new Object[] {_getTime(displayDate), status}; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(3); query.append(_SQL_COUNT_BLOGSENTRY_WHERE); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_LTD_S_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_LTD_S_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_LTD_S_STATUS_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); } private static final String _FINDER_COLUMN_LTD_S_DISPLAYDATE_1 = "blogsEntry.displayDate IS NULL AND "; private static final String _FINDER_COLUMN_LTD_S_DISPLAYDATE_2 = "blogsEntry.displayDate < ? AND "; private static final String _FINDER_COLUMN_LTD_S_STATUS_2 = "blogsEntry.status = ?"; private FinderPath _finderPathWithPaginationFindByG_U_LtD; private FinderPath _finderPathWithPaginationCountByG_U_LtD; /** * Returns all the blogs entries where groupId = ? and userId = ? and displayDate < ?. * * @param groupId the group ID * @param userId the user ID * @param displayDate the display date * @return the matching blogs entries */ @Override public List findByG_U_LtD( long groupId, long userId, Date displayDate) { return findByG_U_LtD( groupId, userId, displayDate, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the blogs entries where groupId = ? and userId = ? and displayDate < ?. * *

* 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

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

* 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

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

* 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param userId the user ID * @param displayDate the display date * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @param retrieveFromCache whether to retrieve from the finder cache * @return the ordered range of matching blogs entries */ @Override public List findByG_U_LtD( long groupId, long userId, Date displayDate, int start, int end, OrderByComparator orderByComparator, boolean retrieveFromCache) { boolean pagination = true; FinderPath finderPath = null; Object[] finderArgs = null; finderPath = _finderPathWithPaginationFindByG_U_LtD; finderArgs = new Object[] { groupId, userId, _getTime(displayDate), start, end, orderByComparator }; List list = null; if (retrieveFromCache) { list = (List)finderCache.getResult( finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (BlogsEntry blogsEntry : list) { if ((groupId != blogsEntry.getGroupId()) || (userId != blogsEntry.getUserId()) || (displayDate.getTime() <= blogsEntry.getDisplayDate().getTime())) { list = null; break; } } } } if (list == null) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 5 + (orderByComparator.getOrderByFields().length * 2)); } else { query = new StringBundler(5); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_U_LTD_GROUPID_2); query.append(_FINDER_COLUMN_G_U_LTD_USERID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_U_LTD_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_U_LTD_DISPLAYDATE_2); } if (orderByComparator != null) { appendOrderByComparator( query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(userId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } if (!pagination) { list = (List)QueryUtil.list( q, getDialect(), start, end, false); Collections.sort(list); list = Collections.unmodifiableList(list); } else { list = (List)QueryUtil.list( q, getDialect(), start, end); } cacheResult(list); finderCache.putResult(finderPath, finderArgs, list); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; } /** * Returns the first blogs entry in the ordered set where groupId = ? and userId = ? and displayDate < ?. * * @param groupId the group ID * @param userId the user ID * @param displayDate the display date * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByG_U_LtD_First( long groupId, long userId, Date displayDate, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByG_U_LtD_First( groupId, userId, displayDate, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(8); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("groupId="); msg.append(groupId); msg.append(", userId="); msg.append(userId); msg.append(", displayDate="); msg.append(displayDate); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the first blogs entry in the ordered set where groupId = ? and userId = ? and displayDate < ?. * * @param groupId the group ID * @param userId the user ID * @param displayDate the display date * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry fetchByG_U_LtD_First( long groupId, long userId, Date displayDate, OrderByComparator orderByComparator) { List list = findByG_U_LtD( groupId, userId, displayDate, 0, 1, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the last blogs entry in the ordered set where groupId = ? and userId = ? and displayDate < ?. * * @param groupId the group ID * @param userId the user ID * @param displayDate the display date * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByG_U_LtD_Last( long groupId, long userId, Date displayDate, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByG_U_LtD_Last( groupId, userId, displayDate, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(8); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("groupId="); msg.append(groupId); msg.append(", userId="); msg.append(userId); msg.append(", displayDate="); msg.append(displayDate); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the last blogs entry in the ordered set where groupId = ? and userId = ? and displayDate < ?. * * @param groupId the group ID * @param userId the user ID * @param displayDate the display date * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry fetchByG_U_LtD_Last( long groupId, long userId, Date displayDate, OrderByComparator orderByComparator) { int count = countByG_U_LtD(groupId, userId, displayDate); if (count == 0) { return null; } List list = findByG_U_LtD( groupId, userId, displayDate, count - 1, count, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the blogs entries before and after the current blogs entry in the ordered set where groupId = ? and userId = ? and displayDate < ?. * * @param entryId the primary key of the current blogs entry * @param groupId the group ID * @param userId the user ID * @param displayDate the display date * @param orderByComparator the comparator to order the set by (optionally null) * @return the previous, current, and next blogs entry * @throws NoSuchEntryException if a blogs entry with the primary key could not be found */ @Override public BlogsEntry[] findByG_U_LtD_PrevAndNext( long entryId, long groupId, long userId, Date displayDate, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BlogsEntry[] array = new BlogsEntryImpl[3]; array[0] = getByG_U_LtD_PrevAndNext( session, blogsEntry, groupId, userId, displayDate, orderByComparator, true); array[1] = blogsEntry; array[2] = getByG_U_LtD_PrevAndNext( session, blogsEntry, groupId, userId, displayDate, orderByComparator, false); return array; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } protected BlogsEntry getByG_U_LtD_PrevAndNext( Session session, BlogsEntry blogsEntry, long groupId, long userId, Date displayDate, OrderByComparator orderByComparator, boolean previous) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 6 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(5); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_U_LTD_GROUPID_2); query.append(_FINDER_COLUMN_G_U_LTD_USERID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_U_LTD_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_U_LTD_DISPLAYDATE_2); } if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { query.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByConditionFields[i]); if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN_HAS_NEXT); } else { query.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN); } else { query.append(WHERE_LESSER_THAN); } } } query.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByFields[i]); if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC_HAS_NEXT); } else { query.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC); } else { query.append(ORDER_BY_DESC); } } } } else { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Query q = session.createQuery(sql); q.setFirstResult(0); q.setMaxResults(2); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(userId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues(blogsEntry)) { qPos.add(orderByConditionValue); } } List list = q.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Returns all the blogs entries that the user has permission to view where groupId = ? and userId = ? and displayDate < ?. * * @param groupId the group ID * @param userId the user ID * @param displayDate the display date * @return the matching blogs entries that the user has permission to view */ @Override public List filterFindByG_U_LtD( long groupId, long userId, Date displayDate) { return filterFindByG_U_LtD( groupId, userId, displayDate, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the blogs entries that the user has permission to view where groupId = ? and userId = ? and displayDate < ?. * *

* 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

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

* 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param userId the user ID * @param displayDate the display date * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching blogs entries that the user has permission to view */ @Override public List filterFindByG_U_LtD( long groupId, long userId, Date displayDate, int start, int end, OrderByComparator orderByComparator) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByG_U_LtD( groupId, userId, displayDate, start, end, orderByComparator); } StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 5 + (orderByComparator.getOrderByFields().length * 2)); } else { query = new StringBundler(6); } if (getDB().isSupportsInlineDistinct()) { query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE); } else { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1); } query.append(_FINDER_COLUMN_G_U_LTD_GROUPID_2); query.append(_FINDER_COLUMN_G_U_LTD_USERID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_U_LTD_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_U_LTD_DISPLAYDATE_2); } if (!getDB().isSupportsInlineDistinct()) { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { if (getDB().isSupportsInlineDistinct()) { appendOrderByComparator( query, _ORDER_BY_ENTITY_ALIAS, orderByComparator, true); } else { appendOrderByComparator( query, _ORDER_BY_ENTITY_TABLE, orderByComparator, true); } } else { if (getDB().isSupportsInlineDistinct()) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } else { query.append(BlogsEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck( query.toString(), BlogsEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery q = session.createSynchronizedSQLQuery(sql); if (getDB().isSupportsInlineDistinct()) { q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class); } else { q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class); } QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(userId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } return (List)QueryUtil.list( q, getDialect(), start, end); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } /** * Returns the blogs entries before and after the current blogs entry in the ordered set of blogs entries that the user has permission to view where groupId = ? and userId = ? and displayDate < ?. * * @param entryId the primary key of the current blogs entry * @param groupId the group ID * @param userId the user ID * @param displayDate the display date * @param orderByComparator the comparator to order the set by (optionally null) * @return the previous, current, and next blogs entry * @throws NoSuchEntryException if a blogs entry with the primary key could not be found */ @Override public BlogsEntry[] filterFindByG_U_LtD_PrevAndNext( long entryId, long groupId, long userId, Date displayDate, OrderByComparator orderByComparator) throws NoSuchEntryException { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByG_U_LtD_PrevAndNext( entryId, groupId, userId, displayDate, orderByComparator); } BlogsEntry blogsEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BlogsEntry[] array = new BlogsEntryImpl[3]; array[0] = filterGetByG_U_LtD_PrevAndNext( session, blogsEntry, groupId, userId, displayDate, orderByComparator, true); array[1] = blogsEntry; array[2] = filterGetByG_U_LtD_PrevAndNext( session, blogsEntry, groupId, userId, displayDate, orderByComparator, false); return array; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } protected BlogsEntry filterGetByG_U_LtD_PrevAndNext( Session session, BlogsEntry blogsEntry, long groupId, long userId, Date displayDate, OrderByComparator orderByComparator, boolean previous) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 7 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(6); } if (getDB().isSupportsInlineDistinct()) { query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE); } else { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1); } query.append(_FINDER_COLUMN_G_U_LTD_GROUPID_2); query.append(_FINDER_COLUMN_G_U_LTD_USERID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_U_LTD_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_U_LTD_DISPLAYDATE_2); } if (!getDB().isSupportsInlineDistinct()) { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { query.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { if (getDB().isSupportsInlineDistinct()) { query.append( getColumnName( _ORDER_BY_ENTITY_ALIAS, orderByConditionFields[i], true)); } else { query.append( getColumnName( _ORDER_BY_ENTITY_TABLE, orderByConditionFields[i], true)); } if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN_HAS_NEXT); } else { query.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN); } else { query.append(WHERE_LESSER_THAN); } } } query.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { if (getDB().isSupportsInlineDistinct()) { query.append( getColumnName( _ORDER_BY_ENTITY_ALIAS, orderByFields[i], true)); } else { query.append( getColumnName( _ORDER_BY_ENTITY_TABLE, orderByFields[i], true)); } if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC_HAS_NEXT); } else { query.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC); } else { query.append(ORDER_BY_DESC); } } } } else { if (getDB().isSupportsInlineDistinct()) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } else { query.append(BlogsEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck( query.toString(), BlogsEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); SQLQuery q = session.createSynchronizedSQLQuery(sql); q.setFirstResult(0); q.setMaxResults(2); if (getDB().isSupportsInlineDistinct()) { q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class); } else { q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class); } QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(userId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues(blogsEntry)) { qPos.add(orderByConditionValue); } } List list = q.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Removes all the blogs entries where groupId = ? and userId = ? and displayDate < ? from the database. * * @param groupId the group ID * @param userId the user ID * @param displayDate the display date */ @Override public void removeByG_U_LtD(long groupId, long userId, Date displayDate) { for (BlogsEntry blogsEntry : findByG_U_LtD( groupId, userId, displayDate, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(blogsEntry); } } /** * Returns the number of blogs entries where groupId = ? and userId = ? and displayDate < ?. * * @param groupId the group ID * @param userId the user ID * @param displayDate the display date * @return the number of matching blogs entries */ @Override public int countByG_U_LtD(long groupId, long userId, Date displayDate) { FinderPath finderPath = _finderPathWithPaginationCountByG_U_LtD; Object[] finderArgs = new Object[] { groupId, userId, _getTime(displayDate) }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(4); query.append(_SQL_COUNT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_U_LTD_GROUPID_2); query.append(_FINDER_COLUMN_G_U_LTD_USERID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_U_LTD_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_U_LTD_DISPLAYDATE_2); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(userId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); } /** * Returns the number of blogs entries that the user has permission to view where groupId = ? and userId = ? and displayDate < ?. * * @param groupId the group ID * @param userId the user ID * @param displayDate the display date * @return the number of matching blogs entries that the user has permission to view */ @Override public int filterCountByG_U_LtD( long groupId, long userId, Date displayDate) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return countByG_U_LtD(groupId, userId, displayDate); } StringBundler query = new StringBundler(4); query.append(_FILTER_SQL_COUNT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_U_LTD_GROUPID_2); query.append(_FINDER_COLUMN_G_U_LTD_USERID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_U_LTD_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_U_LTD_DISPLAYDATE_2); } String sql = InlineSQLHelperUtil.replacePermissionCheck( query.toString(), BlogsEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery q = session.createSynchronizedSQLQuery(sql); q.addScalar( COUNT_COLUMN_NAME, com.liferay.portal.kernel.dao.orm.Type.LONG); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(userId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } Long count = (Long)q.uniqueResult(); return count.intValue(); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } private static final String _FINDER_COLUMN_G_U_LTD_GROUPID_2 = "blogsEntry.groupId = ? AND "; private static final String _FINDER_COLUMN_G_U_LTD_USERID_2 = "blogsEntry.userId = ? AND "; private static final String _FINDER_COLUMN_G_U_LTD_DISPLAYDATE_1 = "blogsEntry.displayDate IS NULL"; private static final String _FINDER_COLUMN_G_U_LTD_DISPLAYDATE_2 = "blogsEntry.displayDate < ?"; private FinderPath _finderPathWithPaginationFindByG_U_S; private FinderPath _finderPathWithoutPaginationFindByG_U_S; private FinderPath _finderPathCountByG_U_S; private FinderPath _finderPathWithPaginationCountByG_U_S; /** * Returns all the blogs entries where groupId = ? and userId = ? and status = ?. * * @param groupId the group ID * @param userId the user ID * @param status the status * @return the matching blogs 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 blogs 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param userId the user ID * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @return the range of matching blogs 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 blogs 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param userId the user ID * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching blogs 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 blogs 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param userId the user ID * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @param retrieveFromCache whether to retrieve from the finder cache * @return the ordered range of matching blogs entries */ @Override public List findByG_U_S( long groupId, long userId, int status, int start, int end, OrderByComparator orderByComparator, boolean retrieveFromCache) { boolean pagination = true; FinderPath finderPath = null; Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { pagination = false; finderPath = _finderPathWithoutPaginationFindByG_U_S; finderArgs = new Object[] {groupId, userId, status}; } else { finderPath = _finderPathWithPaginationFindByG_U_S; finderArgs = new Object[] { groupId, userId, status, start, end, orderByComparator }; } List list = null; if (retrieveFromCache) { list = (List)finderCache.getResult( finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (BlogsEntry blogsEntry : list) { if ((groupId != blogsEntry.getGroupId()) || (userId != blogsEntry.getUserId()) || (status != blogsEntry.getStatus())) { list = null; break; } } } } if (list == null) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 5 + (orderByComparator.getOrderByFields().length * 2)); } else { query = new StringBundler(5); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_U_S_GROUPID_2); query.append(_FINDER_COLUMN_G_U_S_USERID_2); query.append(_FINDER_COLUMN_G_U_S_STATUS_2); if (orderByComparator != null) { appendOrderByComparator( query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(userId); qPos.add(status); if (!pagination) { list = (List)QueryUtil.list( q, getDialect(), start, end, false); Collections.sort(list); list = Collections.unmodifiableList(list); } else { list = (List)QueryUtil.list( q, getDialect(), start, end); } cacheResult(list); finderCache.putResult(finderPath, finderArgs, list); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; } /** * Returns the first blogs 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 blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByG_U_S_First( long groupId, long userId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByG_U_S_First( groupId, userId, status, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(8); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("groupId="); msg.append(groupId); msg.append(", userId="); msg.append(userId); msg.append(", status="); msg.append(status); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the first blogs 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 blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry 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 blogs 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 blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByG_U_S_Last( long groupId, long userId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByG_U_S_Last( groupId, userId, status, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(8); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("groupId="); msg.append(groupId); msg.append(", userId="); msg.append(userId); msg.append(", status="); msg.append(status); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the last blogs 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 blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry 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 blogs entries before and after the current blogs entry in the ordered set where groupId = ? and userId = ? and status = ?. * * @param entryId the primary key of the current blogs 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 blogs entry * @throws NoSuchEntryException if a blogs entry with the primary key could not be found */ @Override public BlogsEntry[] findByG_U_S_PrevAndNext( long entryId, long groupId, long userId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BlogsEntry[] array = new BlogsEntryImpl[3]; array[0] = getByG_U_S_PrevAndNext( session, blogsEntry, groupId, userId, status, orderByComparator, true); array[1] = blogsEntry; array[2] = getByG_U_S_PrevAndNext( session, blogsEntry, groupId, userId, status, orderByComparator, false); return array; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } protected BlogsEntry getByG_U_S_PrevAndNext( Session session, BlogsEntry blogsEntry, long groupId, long userId, int status, OrderByComparator orderByComparator, boolean previous) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 6 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(5); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_U_S_GROUPID_2); query.append(_FINDER_COLUMN_G_U_S_USERID_2); query.append(_FINDER_COLUMN_G_U_S_STATUS_2); if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { query.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByConditionFields[i]); if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN_HAS_NEXT); } else { query.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN); } else { query.append(WHERE_LESSER_THAN); } } } query.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByFields[i]); if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC_HAS_NEXT); } else { query.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC); } else { query.append(ORDER_BY_DESC); } } } } else { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Query q = session.createQuery(sql); q.setFirstResult(0); q.setMaxResults(2); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(userId); qPos.add(status); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues(blogsEntry)) { qPos.add(orderByConditionValue); } } List list = q.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Returns all the blogs 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 blogs 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 blogs 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param userId the user ID * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @return the range of matching blogs 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 blogs 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param userId the user ID * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching blogs 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 query = null; if (orderByComparator != null) { query = new StringBundler( 5 + (orderByComparator.getOrderByFields().length * 2)); } else { query = new StringBundler(6); } if (getDB().isSupportsInlineDistinct()) { query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE); } else { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1); } query.append(_FINDER_COLUMN_G_U_S_GROUPID_2); query.append(_FINDER_COLUMN_G_U_S_USERID_2); query.append(_FINDER_COLUMN_G_U_S_STATUS_2); if (!getDB().isSupportsInlineDistinct()) { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { if (getDB().isSupportsInlineDistinct()) { appendOrderByComparator( query, _ORDER_BY_ENTITY_ALIAS, orderByComparator, true); } else { appendOrderByComparator( query, _ORDER_BY_ENTITY_TABLE, orderByComparator, true); } } else { if (getDB().isSupportsInlineDistinct()) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } else { query.append(BlogsEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck( query.toString(), BlogsEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery q = session.createSynchronizedSQLQuery(sql); if (getDB().isSupportsInlineDistinct()) { q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class); } else { q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class); } QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(userId); qPos.add(status); return (List)QueryUtil.list( q, getDialect(), start, end); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } /** * Returns the blogs entries before and after the current blogs entry in the ordered set of blogs entries that the user has permission to view where groupId = ? and userId = ? and status = ?. * * @param entryId the primary key of the current blogs 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 blogs entry * @throws NoSuchEntryException if a blogs entry with the primary key could not be found */ @Override public BlogsEntry[] 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); } BlogsEntry blogsEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BlogsEntry[] array = new BlogsEntryImpl[3]; array[0] = filterGetByG_U_S_PrevAndNext( session, blogsEntry, groupId, userId, status, orderByComparator, true); array[1] = blogsEntry; array[2] = filterGetByG_U_S_PrevAndNext( session, blogsEntry, groupId, userId, status, orderByComparator, false); return array; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } protected BlogsEntry filterGetByG_U_S_PrevAndNext( Session session, BlogsEntry blogsEntry, long groupId, long userId, int status, OrderByComparator orderByComparator, boolean previous) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 7 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(6); } if (getDB().isSupportsInlineDistinct()) { query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE); } else { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1); } query.append(_FINDER_COLUMN_G_U_S_GROUPID_2); query.append(_FINDER_COLUMN_G_U_S_USERID_2); query.append(_FINDER_COLUMN_G_U_S_STATUS_2); if (!getDB().isSupportsInlineDistinct()) { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { query.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { if (getDB().isSupportsInlineDistinct()) { query.append( getColumnName( _ORDER_BY_ENTITY_ALIAS, orderByConditionFields[i], true)); } else { query.append( getColumnName( _ORDER_BY_ENTITY_TABLE, orderByConditionFields[i], true)); } if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN_HAS_NEXT); } else { query.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN); } else { query.append(WHERE_LESSER_THAN); } } } query.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { if (getDB().isSupportsInlineDistinct()) { query.append( getColumnName( _ORDER_BY_ENTITY_ALIAS, orderByFields[i], true)); } else { query.append( getColumnName( _ORDER_BY_ENTITY_TABLE, orderByFields[i], true)); } if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC_HAS_NEXT); } else { query.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC); } else { query.append(ORDER_BY_DESC); } } } } else { if (getDB().isSupportsInlineDistinct()) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } else { query.append(BlogsEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck( query.toString(), BlogsEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); SQLQuery q = session.createSynchronizedSQLQuery(sql); q.setFirstResult(0); q.setMaxResults(2); if (getDB().isSupportsInlineDistinct()) { q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class); } else { q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class); } QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(userId); qPos.add(status); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues(blogsEntry)) { qPos.add(orderByConditionValue); } } List list = q.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Returns all the blogs entries that the user has permission to view where groupId = ? and userId = ? and status = any ?. * * @param groupId the group ID * @param userId the user ID * @param statuses the statuses * @return the matching blogs entries that the user has permission to view */ @Override public List filterFindByG_U_S( long groupId, long userId, int[] statuses) { return filterFindByG_U_S( groupId, userId, statuses, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the blogs entries that the user has permission to view where groupId = ? and userId = ? and status = 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param userId the user ID * @param statuses the statuses * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @return the range of matching blogs entries that the user has permission to view */ @Override public List filterFindByG_U_S( long groupId, long userId, int[] statuses, int start, int end) { return filterFindByG_U_S(groupId, userId, statuses, start, end, null); } /** * Returns an ordered range of all the blogs entries that the user has permission to view where groupId = ? and userId = ? and status = 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param userId the user ID * @param statuses the statuses * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching blogs entries that the user has permission to view */ @Override public List filterFindByG_U_S( long groupId, long userId, int[] statuses, int start, int end, OrderByComparator orderByComparator) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByG_U_S( groupId, userId, statuses, start, end, orderByComparator); } if (statuses == null) { statuses = new int[0]; } else if (statuses.length > 1) { statuses = ArrayUtil.sortedUnique(statuses); } StringBundler query = new StringBundler(); if (getDB().isSupportsInlineDistinct()) { query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE); } else { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1); } query.append(_FINDER_COLUMN_G_U_S_GROUPID_2); query.append(_FINDER_COLUMN_G_U_S_USERID_2); if (statuses.length > 0) { query.append("("); query.append(_FINDER_COLUMN_G_U_S_STATUS_7); query.append(StringUtil.merge(statuses)); query.append(")"); query.append(")"); } query.setStringAt( removeConjunction(query.stringAt(query.index() - 1)), query.index() - 1); if (!getDB().isSupportsInlineDistinct()) { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { if (getDB().isSupportsInlineDistinct()) { appendOrderByComparator( query, _ORDER_BY_ENTITY_ALIAS, orderByComparator, true); } else { appendOrderByComparator( query, _ORDER_BY_ENTITY_TABLE, orderByComparator, true); } } else { if (getDB().isSupportsInlineDistinct()) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } else { query.append(BlogsEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck( query.toString(), BlogsEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery q = session.createSynchronizedSQLQuery(sql); if (getDB().isSupportsInlineDistinct()) { q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class); } else { q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class); } QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(userId); return (List)QueryUtil.list( q, getDialect(), start, end); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } /** * Returns all the blogs entries where groupId = ? and userId = ? and status = 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param userId the user ID * @param statuses the statuses * @return the matching blogs entries */ @Override public List findByG_U_S( long groupId, long userId, int[] statuses) { return findByG_U_S( groupId, userId, statuses, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the blogs entries where groupId = ? and userId = ? and status = 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param userId the user ID * @param statuses the statuses * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @return the range of matching blogs entries */ @Override public List findByG_U_S( long groupId, long userId, int[] statuses, int start, int end) { return findByG_U_S(groupId, userId, statuses, start, end, null); } /** * Returns an ordered range of all the blogs entries where groupId = ? and userId = ? and status = 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param userId the user ID * @param statuses the statuses * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching blogs entries */ @Override public List findByG_U_S( long groupId, long userId, int[] statuses, int start, int end, OrderByComparator orderByComparator) { return findByG_U_S( groupId, userId, statuses, start, end, orderByComparator, true); } /** * Returns an ordered range of all the blogs entries where groupId = ? and userId = ? 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param userId the user ID * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @param retrieveFromCache whether to retrieve from the finder cache * @return the ordered range of matching blogs entries */ @Override public List findByG_U_S( long groupId, long userId, int[] statuses, int start, int end, OrderByComparator orderByComparator, boolean retrieveFromCache) { if (statuses == null) { statuses = new int[0]; } else if (statuses.length > 1) { statuses = ArrayUtil.sortedUnique(statuses); } if (statuses.length == 1) { return findByG_U_S( groupId, userId, statuses[0], start, end, orderByComparator); } boolean pagination = true; Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { pagination = false; finderArgs = new Object[] { groupId, userId, StringUtil.merge(statuses) }; } else { finderArgs = new Object[] { groupId, userId, StringUtil.merge(statuses), start, end, orderByComparator }; } List list = null; if (retrieveFromCache) { list = (List)finderCache.getResult( _finderPathWithPaginationFindByG_U_S, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (BlogsEntry blogsEntry : list) { if ((groupId != blogsEntry.getGroupId()) || (userId != blogsEntry.getUserId()) || !ArrayUtil.contains(statuses, blogsEntry.getStatus())) { list = null; break; } } } } if (list == null) { StringBundler query = new StringBundler(); query.append(_SQL_SELECT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_U_S_GROUPID_2); query.append(_FINDER_COLUMN_G_U_S_USERID_2); if (statuses.length > 0) { query.append("("); query.append(_FINDER_COLUMN_G_U_S_STATUS_7); query.append(StringUtil.merge(statuses)); query.append(")"); query.append(")"); } query.setStringAt( removeConjunction(query.stringAt(query.index() - 1)), query.index() - 1); if (orderByComparator != null) { appendOrderByComparator( query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(userId); if (!pagination) { list = (List)QueryUtil.list( q, getDialect(), start, end, false); Collections.sort(list); list = Collections.unmodifiableList(list); } else { list = (List)QueryUtil.list( q, getDialect(), start, end); } cacheResult(list); finderCache.putResult( _finderPathWithPaginationFindByG_U_S, finderArgs, list); } catch (Exception e) { finderCache.removeResult( _finderPathWithPaginationFindByG_U_S, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; } /** * Removes all the blogs 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 (BlogsEntry blogsEntry : findByG_U_S( groupId, userId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(blogsEntry); } } /** * Returns the number of blogs 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 blogs entries */ @Override public int countByG_U_S(long groupId, long userId, int status) { FinderPath finderPath = _finderPathCountByG_U_S; Object[] finderArgs = new Object[] {groupId, userId, status}; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(4); query.append(_SQL_COUNT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_U_S_GROUPID_2); query.append(_FINDER_COLUMN_G_U_S_USERID_2); query.append(_FINDER_COLUMN_G_U_S_STATUS_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(userId); qPos.add(status); count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); } /** * Returns the number of blogs entries where groupId = ? and userId = ? and status = any ?. * * @param groupId the group ID * @param userId the user ID * @param statuses the statuses * @return the number of matching blogs entries */ @Override public int countByG_U_S(long groupId, long userId, int[] statuses) { if (statuses == null) { statuses = new int[0]; } else if (statuses.length > 1) { statuses = ArrayUtil.sortedUnique(statuses); } Object[] finderArgs = new Object[] { groupId, userId, StringUtil.merge(statuses) }; Long count = (Long)finderCache.getResult( _finderPathWithPaginationCountByG_U_S, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(); query.append(_SQL_COUNT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_U_S_GROUPID_2); query.append(_FINDER_COLUMN_G_U_S_USERID_2); if (statuses.length > 0) { query.append("("); query.append(_FINDER_COLUMN_G_U_S_STATUS_7); query.append(StringUtil.merge(statuses)); query.append(")"); query.append(")"); } query.setStringAt( removeConjunction(query.stringAt(query.index() - 1)), query.index() - 1); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(userId); count = (Long)q.uniqueResult(); finderCache.putResult( _finderPathWithPaginationCountByG_U_S, finderArgs, count); } catch (Exception e) { finderCache.removeResult( _finderPathWithPaginationCountByG_U_S, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); } /** * Returns the number of blogs 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 blogs 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 query = new StringBundler(4); query.append(_FILTER_SQL_COUNT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_U_S_GROUPID_2); query.append(_FINDER_COLUMN_G_U_S_USERID_2); query.append(_FINDER_COLUMN_G_U_S_STATUS_2); String sql = InlineSQLHelperUtil.replacePermissionCheck( query.toString(), BlogsEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery q = session.createSynchronizedSQLQuery(sql); q.addScalar( COUNT_COLUMN_NAME, com.liferay.portal.kernel.dao.orm.Type.LONG); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(userId); qPos.add(status); Long count = (Long)q.uniqueResult(); return count.intValue(); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } /** * Returns the number of blogs entries that the user has permission to view where groupId = ? and userId = ? and status = any ?. * * @param groupId the group ID * @param userId the user ID * @param statuses the statuses * @return the number of matching blogs entries that the user has permission to view */ @Override public int filterCountByG_U_S(long groupId, long userId, int[] statuses) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return countByG_U_S(groupId, userId, statuses); } if (statuses == null) { statuses = new int[0]; } else if (statuses.length > 1) { statuses = ArrayUtil.sortedUnique(statuses); } StringBundler query = new StringBundler(); query.append(_FILTER_SQL_COUNT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_U_S_GROUPID_2); query.append(_FINDER_COLUMN_G_U_S_USERID_2); if (statuses.length > 0) { query.append("("); query.append(_FINDER_COLUMN_G_U_S_STATUS_7); query.append(StringUtil.merge(statuses)); query.append(")"); query.append(")"); } query.setStringAt( removeConjunction(query.stringAt(query.index() - 1)), query.index() - 1); String sql = InlineSQLHelperUtil.replacePermissionCheck( query.toString(), BlogsEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery q = session.createSynchronizedSQLQuery(sql); q.addScalar( COUNT_COLUMN_NAME, com.liferay.portal.kernel.dao.orm.Type.LONG); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(userId); Long count = (Long)q.uniqueResult(); return count.intValue(); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } private static final String _FINDER_COLUMN_G_U_S_GROUPID_2 = "blogsEntry.groupId = ? AND "; private static final String _FINDER_COLUMN_G_U_S_USERID_2 = "blogsEntry.userId = ? AND "; private static final String _FINDER_COLUMN_G_U_S_STATUS_2 = "blogsEntry.status = ?"; private static final String _FINDER_COLUMN_G_U_S_STATUS_7 = "blogsEntry.status IN ("; private FinderPath _finderPathWithPaginationFindByG_U_NotS; private FinderPath _finderPathWithPaginationCountByG_U_NotS; /** * Returns all the blogs entries where groupId = ? and userId = ? and status ≠ ?. * * @param groupId the group ID * @param userId the user ID * @param status the status * @return the matching blogs 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 blogs 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param userId the user ID * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @return the range of matching blogs 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 blogs 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param userId the user ID * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching blogs 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 blogs 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param userId the user ID * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @param retrieveFromCache whether to retrieve from the finder cache * @return the ordered range of matching blogs entries */ @Override public List findByG_U_NotS( long groupId, long userId, int status, int start, int end, OrderByComparator orderByComparator, boolean retrieveFromCache) { boolean pagination = true; FinderPath finderPath = null; Object[] finderArgs = null; finderPath = _finderPathWithPaginationFindByG_U_NotS; finderArgs = new Object[] { groupId, userId, status, start, end, orderByComparator }; List list = null; if (retrieveFromCache) { list = (List)finderCache.getResult( finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (BlogsEntry blogsEntry : list) { if ((groupId != blogsEntry.getGroupId()) || (userId != blogsEntry.getUserId()) || (status == blogsEntry.getStatus())) { list = null; break; } } } } if (list == null) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 5 + (orderByComparator.getOrderByFields().length * 2)); } else { query = new StringBundler(5); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_U_NOTS_GROUPID_2); query.append(_FINDER_COLUMN_G_U_NOTS_USERID_2); query.append(_FINDER_COLUMN_G_U_NOTS_STATUS_2); if (orderByComparator != null) { appendOrderByComparator( query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(userId); qPos.add(status); if (!pagination) { list = (List)QueryUtil.list( q, getDialect(), start, end, false); Collections.sort(list); list = Collections.unmodifiableList(list); } else { list = (List)QueryUtil.list( q, getDialect(), start, end); } cacheResult(list); finderCache.putResult(finderPath, finderArgs, list); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; } /** * Returns the first blogs 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 blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByG_U_NotS_First( long groupId, long userId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByG_U_NotS_First( groupId, userId, status, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(8); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("groupId="); msg.append(groupId); msg.append(", userId="); msg.append(userId); msg.append(", status="); msg.append(status); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the first blogs 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 blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry 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 blogs 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 blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByG_U_NotS_Last( long groupId, long userId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByG_U_NotS_Last( groupId, userId, status, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(8); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("groupId="); msg.append(groupId); msg.append(", userId="); msg.append(userId); msg.append(", status="); msg.append(status); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the last blogs 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 blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry 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 blogs entries before and after the current blogs entry in the ordered set where groupId = ? and userId = ? and status ≠ ?. * * @param entryId the primary key of the current blogs 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 blogs entry * @throws NoSuchEntryException if a blogs entry with the primary key could not be found */ @Override public BlogsEntry[] findByG_U_NotS_PrevAndNext( long entryId, long groupId, long userId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BlogsEntry[] array = new BlogsEntryImpl[3]; array[0] = getByG_U_NotS_PrevAndNext( session, blogsEntry, groupId, userId, status, orderByComparator, true); array[1] = blogsEntry; array[2] = getByG_U_NotS_PrevAndNext( session, blogsEntry, groupId, userId, status, orderByComparator, false); return array; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } protected BlogsEntry getByG_U_NotS_PrevAndNext( Session session, BlogsEntry blogsEntry, long groupId, long userId, int status, OrderByComparator orderByComparator, boolean previous) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 6 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(5); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_U_NOTS_GROUPID_2); query.append(_FINDER_COLUMN_G_U_NOTS_USERID_2); query.append(_FINDER_COLUMN_G_U_NOTS_STATUS_2); if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { query.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByConditionFields[i]); if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN_HAS_NEXT); } else { query.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN); } else { query.append(WHERE_LESSER_THAN); } } } query.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByFields[i]); if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC_HAS_NEXT); } else { query.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC); } else { query.append(ORDER_BY_DESC); } } } } else { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Query q = session.createQuery(sql); q.setFirstResult(0); q.setMaxResults(2); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(userId); qPos.add(status); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues(blogsEntry)) { qPos.add(orderByConditionValue); } } List list = q.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Returns all the blogs 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 blogs 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 blogs 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param userId the user ID * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @return the range of matching blogs 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 blogs 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param userId the user ID * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching blogs 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 query = null; if (orderByComparator != null) { query = new StringBundler( 5 + (orderByComparator.getOrderByFields().length * 2)); } else { query = new StringBundler(6); } if (getDB().isSupportsInlineDistinct()) { query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE); } else { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1); } query.append(_FINDER_COLUMN_G_U_NOTS_GROUPID_2); query.append(_FINDER_COLUMN_G_U_NOTS_USERID_2); query.append(_FINDER_COLUMN_G_U_NOTS_STATUS_2); if (!getDB().isSupportsInlineDistinct()) { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { if (getDB().isSupportsInlineDistinct()) { appendOrderByComparator( query, _ORDER_BY_ENTITY_ALIAS, orderByComparator, true); } else { appendOrderByComparator( query, _ORDER_BY_ENTITY_TABLE, orderByComparator, true); } } else { if (getDB().isSupportsInlineDistinct()) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } else { query.append(BlogsEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck( query.toString(), BlogsEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery q = session.createSynchronizedSQLQuery(sql); if (getDB().isSupportsInlineDistinct()) { q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class); } else { q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class); } QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(userId); qPos.add(status); return (List)QueryUtil.list( q, getDialect(), start, end); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } /** * Returns the blogs entries before and after the current blogs entry in the ordered set of blogs entries that the user has permission to view where groupId = ? and userId = ? and status ≠ ?. * * @param entryId the primary key of the current blogs 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 blogs entry * @throws NoSuchEntryException if a blogs entry with the primary key could not be found */ @Override public BlogsEntry[] 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); } BlogsEntry blogsEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BlogsEntry[] array = new BlogsEntryImpl[3]; array[0] = filterGetByG_U_NotS_PrevAndNext( session, blogsEntry, groupId, userId, status, orderByComparator, true); array[1] = blogsEntry; array[2] = filterGetByG_U_NotS_PrevAndNext( session, blogsEntry, groupId, userId, status, orderByComparator, false); return array; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } protected BlogsEntry filterGetByG_U_NotS_PrevAndNext( Session session, BlogsEntry blogsEntry, long groupId, long userId, int status, OrderByComparator orderByComparator, boolean previous) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 7 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(6); } if (getDB().isSupportsInlineDistinct()) { query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE); } else { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1); } query.append(_FINDER_COLUMN_G_U_NOTS_GROUPID_2); query.append(_FINDER_COLUMN_G_U_NOTS_USERID_2); query.append(_FINDER_COLUMN_G_U_NOTS_STATUS_2); if (!getDB().isSupportsInlineDistinct()) { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { query.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { if (getDB().isSupportsInlineDistinct()) { query.append( getColumnName( _ORDER_BY_ENTITY_ALIAS, orderByConditionFields[i], true)); } else { query.append( getColumnName( _ORDER_BY_ENTITY_TABLE, orderByConditionFields[i], true)); } if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN_HAS_NEXT); } else { query.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN); } else { query.append(WHERE_LESSER_THAN); } } } query.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { if (getDB().isSupportsInlineDistinct()) { query.append( getColumnName( _ORDER_BY_ENTITY_ALIAS, orderByFields[i], true)); } else { query.append( getColumnName( _ORDER_BY_ENTITY_TABLE, orderByFields[i], true)); } if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC_HAS_NEXT); } else { query.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC); } else { query.append(ORDER_BY_DESC); } } } } else { if (getDB().isSupportsInlineDistinct()) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } else { query.append(BlogsEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck( query.toString(), BlogsEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); SQLQuery q = session.createSynchronizedSQLQuery(sql); q.setFirstResult(0); q.setMaxResults(2); if (getDB().isSupportsInlineDistinct()) { q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class); } else { q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class); } QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(userId); qPos.add(status); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues(blogsEntry)) { qPos.add(orderByConditionValue); } } List list = q.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Removes all the blogs 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 (BlogsEntry blogsEntry : findByG_U_NotS( groupId, userId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(blogsEntry); } } /** * Returns the number of blogs 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 blogs entries */ @Override public int countByG_U_NotS(long groupId, long userId, int status) { FinderPath finderPath = _finderPathWithPaginationCountByG_U_NotS; Object[] finderArgs = new Object[] {groupId, userId, status}; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(4); query.append(_SQL_COUNT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_U_NOTS_GROUPID_2); query.append(_FINDER_COLUMN_G_U_NOTS_USERID_2); query.append(_FINDER_COLUMN_G_U_NOTS_STATUS_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(userId); qPos.add(status); count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); } /** * Returns the number of blogs 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 blogs 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 query = new StringBundler(4); query.append(_FILTER_SQL_COUNT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_U_NOTS_GROUPID_2); query.append(_FINDER_COLUMN_G_U_NOTS_USERID_2); query.append(_FINDER_COLUMN_G_U_NOTS_STATUS_2); String sql = InlineSQLHelperUtil.replacePermissionCheck( query.toString(), BlogsEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery q = session.createSynchronizedSQLQuery(sql); q.addScalar( COUNT_COLUMN_NAME, com.liferay.portal.kernel.dao.orm.Type.LONG); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(userId); qPos.add(status); Long count = (Long)q.uniqueResult(); return count.intValue(); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } private static final String _FINDER_COLUMN_G_U_NOTS_GROUPID_2 = "blogsEntry.groupId = ? AND "; private static final String _FINDER_COLUMN_G_U_NOTS_USERID_2 = "blogsEntry.userId = ? AND "; private static final String _FINDER_COLUMN_G_U_NOTS_STATUS_2 = "blogsEntry.status != ?"; private FinderPath _finderPathWithPaginationFindByG_D_S; private FinderPath _finderPathWithoutPaginationFindByG_D_S; private FinderPath _finderPathCountByG_D_S; /** * Returns all the blogs entries where groupId = ? and displayDate = ? and status = ?. * * @param groupId the group ID * @param displayDate the display date * @param status the status * @return the matching blogs entries */ @Override public List findByG_D_S( long groupId, Date displayDate, int status) { return findByG_D_S( groupId, displayDate, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the blogs entries where groupId = ? and displayDate = ? 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param displayDate the display date * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @return the range of matching blogs entries */ @Override public List findByG_D_S( long groupId, Date displayDate, int status, int start, int end) { return findByG_D_S(groupId, displayDate, status, start, end, null); } /** * Returns an ordered range of all the blogs entries where groupId = ? and displayDate = ? 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param displayDate the display date * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching blogs entries */ @Override public List findByG_D_S( long groupId, Date displayDate, int status, int start, int end, OrderByComparator orderByComparator) { return findByG_D_S( groupId, displayDate, status, start, end, orderByComparator, true); } /** * Returns an ordered range of all the blogs entries where groupId = ? and displayDate = ? 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param displayDate the display date * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @param retrieveFromCache whether to retrieve from the finder cache * @return the ordered range of matching blogs entries */ @Override public List findByG_D_S( long groupId, Date displayDate, int status, int start, int end, OrderByComparator orderByComparator, boolean retrieveFromCache) { boolean pagination = true; FinderPath finderPath = null; Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { pagination = false; finderPath = _finderPathWithoutPaginationFindByG_D_S; finderArgs = new Object[] {groupId, _getTime(displayDate), status}; } else { finderPath = _finderPathWithPaginationFindByG_D_S; finderArgs = new Object[] { groupId, _getTime(displayDate), status, start, end, orderByComparator }; } List list = null; if (retrieveFromCache) { list = (List)finderCache.getResult( finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (BlogsEntry blogsEntry : list) { if ((groupId != blogsEntry.getGroupId()) || !Objects.equals( displayDate, blogsEntry.getDisplayDate()) || (status != blogsEntry.getStatus())) { list = null; break; } } } } if (list == null) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 5 + (orderByComparator.getOrderByFields().length * 2)); } else { query = new StringBundler(5); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_D_S_GROUPID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_D_S_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_D_S_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_G_D_S_STATUS_2); if (orderByComparator != null) { appendOrderByComparator( query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); if (!pagination) { list = (List)QueryUtil.list( q, getDialect(), start, end, false); Collections.sort(list); list = Collections.unmodifiableList(list); } else { list = (List)QueryUtil.list( q, getDialect(), start, end); } cacheResult(list); finderCache.putResult(finderPath, finderArgs, list); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; } /** * Returns the first blogs entry in the ordered set where groupId = ? and displayDate = ? and status = ?. * * @param groupId the group ID * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByG_D_S_First( long groupId, Date displayDate, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByG_D_S_First( groupId, displayDate, status, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(8); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("groupId="); msg.append(groupId); msg.append(", displayDate="); msg.append(displayDate); msg.append(", status="); msg.append(status); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the first blogs entry in the ordered set where groupId = ? and displayDate = ? and status = ?. * * @param groupId the group ID * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry fetchByG_D_S_First( long groupId, Date displayDate, int status, OrderByComparator orderByComparator) { List list = findByG_D_S( groupId, displayDate, status, 0, 1, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the last blogs entry in the ordered set where groupId = ? and displayDate = ? and status = ?. * * @param groupId the group ID * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByG_D_S_Last( long groupId, Date displayDate, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByG_D_S_Last( groupId, displayDate, status, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(8); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("groupId="); msg.append(groupId); msg.append(", displayDate="); msg.append(displayDate); msg.append(", status="); msg.append(status); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the last blogs entry in the ordered set where groupId = ? and displayDate = ? and status = ?. * * @param groupId the group ID * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry fetchByG_D_S_Last( long groupId, Date displayDate, int status, OrderByComparator orderByComparator) { int count = countByG_D_S(groupId, displayDate, status); if (count == 0) { return null; } List list = findByG_D_S( groupId, displayDate, status, count - 1, count, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the blogs entries before and after the current blogs entry in the ordered set where groupId = ? and displayDate = ? and status = ?. * * @param entryId the primary key of the current blogs entry * @param groupId the group ID * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the previous, current, and next blogs entry * @throws NoSuchEntryException if a blogs entry with the primary key could not be found */ @Override public BlogsEntry[] findByG_D_S_PrevAndNext( long entryId, long groupId, Date displayDate, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BlogsEntry[] array = new BlogsEntryImpl[3]; array[0] = getByG_D_S_PrevAndNext( session, blogsEntry, groupId, displayDate, status, orderByComparator, true); array[1] = blogsEntry; array[2] = getByG_D_S_PrevAndNext( session, blogsEntry, groupId, displayDate, status, orderByComparator, false); return array; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } protected BlogsEntry getByG_D_S_PrevAndNext( Session session, BlogsEntry blogsEntry, long groupId, Date displayDate, int status, OrderByComparator orderByComparator, boolean previous) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 6 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(5); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_D_S_GROUPID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_D_S_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_D_S_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_G_D_S_STATUS_2); if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { query.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByConditionFields[i]); if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN_HAS_NEXT); } else { query.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN); } else { query.append(WHERE_LESSER_THAN); } } } query.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByFields[i]); if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC_HAS_NEXT); } else { query.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC); } else { query.append(ORDER_BY_DESC); } } } } else { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Query q = session.createQuery(sql); q.setFirstResult(0); q.setMaxResults(2); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues(blogsEntry)) { qPos.add(orderByConditionValue); } } List list = q.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Returns all the blogs entries that the user has permission to view where groupId = ? and displayDate = ? and status = ?. * * @param groupId the group ID * @param displayDate the display date * @param status the status * @return the matching blogs entries that the user has permission to view */ @Override public List filterFindByG_D_S( long groupId, Date displayDate, int status) { return filterFindByG_D_S( groupId, displayDate, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the blogs entries that the user has permission to view where groupId = ? and displayDate = ? 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param displayDate the display date * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @return the range of matching blogs entries that the user has permission to view */ @Override public List filterFindByG_D_S( long groupId, Date displayDate, int status, int start, int end) { return filterFindByG_D_S( groupId, displayDate, status, start, end, null); } /** * Returns an ordered range of all the blogs entries that the user has permissions to view where groupId = ? and displayDate = ? 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param displayDate the display date * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching blogs entries that the user has permission to view */ @Override public List filterFindByG_D_S( long groupId, Date displayDate, int status, int start, int end, OrderByComparator orderByComparator) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByG_D_S( groupId, displayDate, status, start, end, orderByComparator); } StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 5 + (orderByComparator.getOrderByFields().length * 2)); } else { query = new StringBundler(6); } if (getDB().isSupportsInlineDistinct()) { query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE); } else { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1); } query.append(_FINDER_COLUMN_G_D_S_GROUPID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_D_S_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_D_S_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_G_D_S_STATUS_2); if (!getDB().isSupportsInlineDistinct()) { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { if (getDB().isSupportsInlineDistinct()) { appendOrderByComparator( query, _ORDER_BY_ENTITY_ALIAS, orderByComparator, true); } else { appendOrderByComparator( query, _ORDER_BY_ENTITY_TABLE, orderByComparator, true); } } else { if (getDB().isSupportsInlineDistinct()) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } else { query.append(BlogsEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck( query.toString(), BlogsEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery q = session.createSynchronizedSQLQuery(sql); if (getDB().isSupportsInlineDistinct()) { q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class); } else { q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class); } QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); return (List)QueryUtil.list( q, getDialect(), start, end); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } /** * Returns the blogs entries before and after the current blogs entry in the ordered set of blogs entries that the user has permission to view where groupId = ? and displayDate = ? and status = ?. * * @param entryId the primary key of the current blogs entry * @param groupId the group ID * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the previous, current, and next blogs entry * @throws NoSuchEntryException if a blogs entry with the primary key could not be found */ @Override public BlogsEntry[] filterFindByG_D_S_PrevAndNext( long entryId, long groupId, Date displayDate, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByG_D_S_PrevAndNext( entryId, groupId, displayDate, status, orderByComparator); } BlogsEntry blogsEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BlogsEntry[] array = new BlogsEntryImpl[3]; array[0] = filterGetByG_D_S_PrevAndNext( session, blogsEntry, groupId, displayDate, status, orderByComparator, true); array[1] = blogsEntry; array[2] = filterGetByG_D_S_PrevAndNext( session, blogsEntry, groupId, displayDate, status, orderByComparator, false); return array; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } protected BlogsEntry filterGetByG_D_S_PrevAndNext( Session session, BlogsEntry blogsEntry, long groupId, Date displayDate, int status, OrderByComparator orderByComparator, boolean previous) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 7 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(6); } if (getDB().isSupportsInlineDistinct()) { query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE); } else { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1); } query.append(_FINDER_COLUMN_G_D_S_GROUPID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_D_S_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_D_S_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_G_D_S_STATUS_2); if (!getDB().isSupportsInlineDistinct()) { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { query.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { if (getDB().isSupportsInlineDistinct()) { query.append( getColumnName( _ORDER_BY_ENTITY_ALIAS, orderByConditionFields[i], true)); } else { query.append( getColumnName( _ORDER_BY_ENTITY_TABLE, orderByConditionFields[i], true)); } if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN_HAS_NEXT); } else { query.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN); } else { query.append(WHERE_LESSER_THAN); } } } query.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { if (getDB().isSupportsInlineDistinct()) { query.append( getColumnName( _ORDER_BY_ENTITY_ALIAS, orderByFields[i], true)); } else { query.append( getColumnName( _ORDER_BY_ENTITY_TABLE, orderByFields[i], true)); } if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC_HAS_NEXT); } else { query.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC); } else { query.append(ORDER_BY_DESC); } } } } else { if (getDB().isSupportsInlineDistinct()) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } else { query.append(BlogsEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck( query.toString(), BlogsEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); SQLQuery q = session.createSynchronizedSQLQuery(sql); q.setFirstResult(0); q.setMaxResults(2); if (getDB().isSupportsInlineDistinct()) { q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class); } else { q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class); } QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues(blogsEntry)) { qPos.add(orderByConditionValue); } } List list = q.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Removes all the blogs entries where groupId = ? and displayDate = ? and status = ? from the database. * * @param groupId the group ID * @param displayDate the display date * @param status the status */ @Override public void removeByG_D_S(long groupId, Date displayDate, int status) { for (BlogsEntry blogsEntry : findByG_D_S( groupId, displayDate, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(blogsEntry); } } /** * Returns the number of blogs entries where groupId = ? and displayDate = ? and status = ?. * * @param groupId the group ID * @param displayDate the display date * @param status the status * @return the number of matching blogs entries */ @Override public int countByG_D_S(long groupId, Date displayDate, int status) { FinderPath finderPath = _finderPathCountByG_D_S; Object[] finderArgs = new Object[] { groupId, _getTime(displayDate), status }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(4); query.append(_SQL_COUNT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_D_S_GROUPID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_D_S_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_D_S_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_G_D_S_STATUS_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); } /** * Returns the number of blogs entries that the user has permission to view where groupId = ? and displayDate = ? and status = ?. * * @param groupId the group ID * @param displayDate the display date * @param status the status * @return the number of matching blogs entries that the user has permission to view */ @Override public int filterCountByG_D_S(long groupId, Date displayDate, int status) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return countByG_D_S(groupId, displayDate, status); } StringBundler query = new StringBundler(4); query.append(_FILTER_SQL_COUNT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_D_S_GROUPID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_D_S_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_D_S_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_G_D_S_STATUS_2); String sql = InlineSQLHelperUtil.replacePermissionCheck( query.toString(), BlogsEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery q = session.createSynchronizedSQLQuery(sql); q.addScalar( COUNT_COLUMN_NAME, com.liferay.portal.kernel.dao.orm.Type.LONG); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); Long count = (Long)q.uniqueResult(); return count.intValue(); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } private static final String _FINDER_COLUMN_G_D_S_GROUPID_2 = "blogsEntry.groupId = ? AND "; private static final String _FINDER_COLUMN_G_D_S_DISPLAYDATE_1 = "blogsEntry.displayDate IS NULL AND "; private static final String _FINDER_COLUMN_G_D_S_DISPLAYDATE_2 = "blogsEntry.displayDate = ? AND "; private static final String _FINDER_COLUMN_G_D_S_STATUS_2 = "blogsEntry.status = ?"; private FinderPath _finderPathWithPaginationFindByG_GtD_S; private FinderPath _finderPathWithPaginationCountByG_GtD_S; /** * Returns all the blogs entries where groupId = ? and displayDate > ? and status = ?. * * @param groupId the group ID * @param displayDate the display date * @param status the status * @return the matching blogs entries */ @Override public List findByG_GtD_S( long groupId, Date displayDate, int status) { return findByG_GtD_S( groupId, displayDate, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the blogs entries where groupId = ? and displayDate > ? 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param displayDate the display date * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @return the range of matching blogs entries */ @Override public List findByG_GtD_S( long groupId, Date displayDate, int status, int start, int end) { return findByG_GtD_S(groupId, displayDate, status, start, end, null); } /** * Returns an ordered range of all the blogs entries where groupId = ? and displayDate > ? 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param displayDate the display date * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching blogs entries */ @Override public List findByG_GtD_S( long groupId, Date displayDate, int status, int start, int end, OrderByComparator orderByComparator) { return findByG_GtD_S( groupId, displayDate, status, start, end, orderByComparator, true); } /** * Returns an ordered range of all the blogs entries where groupId = ? and displayDate > ? 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param displayDate the display date * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @param retrieveFromCache whether to retrieve from the finder cache * @return the ordered range of matching blogs entries */ @Override public List findByG_GtD_S( long groupId, Date displayDate, int status, int start, int end, OrderByComparator orderByComparator, boolean retrieveFromCache) { boolean pagination = true; FinderPath finderPath = null; Object[] finderArgs = null; finderPath = _finderPathWithPaginationFindByG_GtD_S; finderArgs = new Object[] { groupId, _getTime(displayDate), status, start, end, orderByComparator }; List list = null; if (retrieveFromCache) { list = (List)finderCache.getResult( finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (BlogsEntry blogsEntry : list) { if ((groupId != blogsEntry.getGroupId()) || (displayDate.getTime() >= blogsEntry.getDisplayDate().getTime()) || (status != blogsEntry.getStatus())) { list = null; break; } } } } if (list == null) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 5 + (orderByComparator.getOrderByFields().length * 2)); } else { query = new StringBundler(5); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_GTD_S_GROUPID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_GTD_S_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_GTD_S_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_G_GTD_S_STATUS_2); if (orderByComparator != null) { appendOrderByComparator( query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); if (!pagination) { list = (List)QueryUtil.list( q, getDialect(), start, end, false); Collections.sort(list); list = Collections.unmodifiableList(list); } else { list = (List)QueryUtil.list( q, getDialect(), start, end); } cacheResult(list); finderCache.putResult(finderPath, finderArgs, list); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; } /** * Returns the first blogs entry in the ordered set where groupId = ? and displayDate > ? and status = ?. * * @param groupId the group ID * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByG_GtD_S_First( long groupId, Date displayDate, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByG_GtD_S_First( groupId, displayDate, status, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(8); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("groupId="); msg.append(groupId); msg.append(", displayDate="); msg.append(displayDate); msg.append(", status="); msg.append(status); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the first blogs entry in the ordered set where groupId = ? and displayDate > ? and status = ?. * * @param groupId the group ID * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry fetchByG_GtD_S_First( long groupId, Date displayDate, int status, OrderByComparator orderByComparator) { List list = findByG_GtD_S( groupId, displayDate, status, 0, 1, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the last blogs entry in the ordered set where groupId = ? and displayDate > ? and status = ?. * * @param groupId the group ID * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByG_GtD_S_Last( long groupId, Date displayDate, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByG_GtD_S_Last( groupId, displayDate, status, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(8); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("groupId="); msg.append(groupId); msg.append(", displayDate="); msg.append(displayDate); msg.append(", status="); msg.append(status); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the last blogs entry in the ordered set where groupId = ? and displayDate > ? and status = ?. * * @param groupId the group ID * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry fetchByG_GtD_S_Last( long groupId, Date displayDate, int status, OrderByComparator orderByComparator) { int count = countByG_GtD_S(groupId, displayDate, status); if (count == 0) { return null; } List list = findByG_GtD_S( groupId, displayDate, status, count - 1, count, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the blogs entries before and after the current blogs entry in the ordered set where groupId = ? and displayDate > ? and status = ?. * * @param entryId the primary key of the current blogs entry * @param groupId the group ID * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the previous, current, and next blogs entry * @throws NoSuchEntryException if a blogs entry with the primary key could not be found */ @Override public BlogsEntry[] findByG_GtD_S_PrevAndNext( long entryId, long groupId, Date displayDate, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BlogsEntry[] array = new BlogsEntryImpl[3]; array[0] = getByG_GtD_S_PrevAndNext( session, blogsEntry, groupId, displayDate, status, orderByComparator, true); array[1] = blogsEntry; array[2] = getByG_GtD_S_PrevAndNext( session, blogsEntry, groupId, displayDate, status, orderByComparator, false); return array; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } protected BlogsEntry getByG_GtD_S_PrevAndNext( Session session, BlogsEntry blogsEntry, long groupId, Date displayDate, int status, OrderByComparator orderByComparator, boolean previous) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 6 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(5); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_GTD_S_GROUPID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_GTD_S_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_GTD_S_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_G_GTD_S_STATUS_2); if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { query.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByConditionFields[i]); if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN_HAS_NEXT); } else { query.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN); } else { query.append(WHERE_LESSER_THAN); } } } query.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByFields[i]); if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC_HAS_NEXT); } else { query.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC); } else { query.append(ORDER_BY_DESC); } } } } else { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Query q = session.createQuery(sql); q.setFirstResult(0); q.setMaxResults(2); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues(blogsEntry)) { qPos.add(orderByConditionValue); } } List list = q.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Returns all the blogs entries that the user has permission to view where groupId = ? and displayDate > ? and status = ?. * * @param groupId the group ID * @param displayDate the display date * @param status the status * @return the matching blogs entries that the user has permission to view */ @Override public List filterFindByG_GtD_S( long groupId, Date displayDate, int status) { return filterFindByG_GtD_S( groupId, displayDate, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the blogs entries that the user has permission to view where groupId = ? and displayDate > ? 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param displayDate the display date * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @return the range of matching blogs entries that the user has permission to view */ @Override public List filterFindByG_GtD_S( long groupId, Date displayDate, int status, int start, int end) { return filterFindByG_GtD_S( groupId, displayDate, status, start, end, null); } /** * Returns an ordered range of all the blogs entries that the user has permissions to view where groupId = ? and displayDate > ? 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param displayDate the display date * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching blogs entries that the user has permission to view */ @Override public List filterFindByG_GtD_S( long groupId, Date displayDate, int status, int start, int end, OrderByComparator orderByComparator) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByG_GtD_S( groupId, displayDate, status, start, end, orderByComparator); } StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 5 + (orderByComparator.getOrderByFields().length * 2)); } else { query = new StringBundler(6); } if (getDB().isSupportsInlineDistinct()) { query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE); } else { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1); } query.append(_FINDER_COLUMN_G_GTD_S_GROUPID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_GTD_S_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_GTD_S_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_G_GTD_S_STATUS_2); if (!getDB().isSupportsInlineDistinct()) { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { if (getDB().isSupportsInlineDistinct()) { appendOrderByComparator( query, _ORDER_BY_ENTITY_ALIAS, orderByComparator, true); } else { appendOrderByComparator( query, _ORDER_BY_ENTITY_TABLE, orderByComparator, true); } } else { if (getDB().isSupportsInlineDistinct()) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } else { query.append(BlogsEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck( query.toString(), BlogsEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery q = session.createSynchronizedSQLQuery(sql); if (getDB().isSupportsInlineDistinct()) { q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class); } else { q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class); } QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); return (List)QueryUtil.list( q, getDialect(), start, end); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } /** * Returns the blogs entries before and after the current blogs entry in the ordered set of blogs entries that the user has permission to view where groupId = ? and displayDate > ? and status = ?. * * @param entryId the primary key of the current blogs entry * @param groupId the group ID * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the previous, current, and next blogs entry * @throws NoSuchEntryException if a blogs entry with the primary key could not be found */ @Override public BlogsEntry[] filterFindByG_GtD_S_PrevAndNext( long entryId, long groupId, Date displayDate, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByG_GtD_S_PrevAndNext( entryId, groupId, displayDate, status, orderByComparator); } BlogsEntry blogsEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BlogsEntry[] array = new BlogsEntryImpl[3]; array[0] = filterGetByG_GtD_S_PrevAndNext( session, blogsEntry, groupId, displayDate, status, orderByComparator, true); array[1] = blogsEntry; array[2] = filterGetByG_GtD_S_PrevAndNext( session, blogsEntry, groupId, displayDate, status, orderByComparator, false); return array; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } protected BlogsEntry filterGetByG_GtD_S_PrevAndNext( Session session, BlogsEntry blogsEntry, long groupId, Date displayDate, int status, OrderByComparator orderByComparator, boolean previous) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 7 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(6); } if (getDB().isSupportsInlineDistinct()) { query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE); } else { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1); } query.append(_FINDER_COLUMN_G_GTD_S_GROUPID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_GTD_S_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_GTD_S_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_G_GTD_S_STATUS_2); if (!getDB().isSupportsInlineDistinct()) { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { query.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { if (getDB().isSupportsInlineDistinct()) { query.append( getColumnName( _ORDER_BY_ENTITY_ALIAS, orderByConditionFields[i], true)); } else { query.append( getColumnName( _ORDER_BY_ENTITY_TABLE, orderByConditionFields[i], true)); } if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN_HAS_NEXT); } else { query.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN); } else { query.append(WHERE_LESSER_THAN); } } } query.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { if (getDB().isSupportsInlineDistinct()) { query.append( getColumnName( _ORDER_BY_ENTITY_ALIAS, orderByFields[i], true)); } else { query.append( getColumnName( _ORDER_BY_ENTITY_TABLE, orderByFields[i], true)); } if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC_HAS_NEXT); } else { query.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC); } else { query.append(ORDER_BY_DESC); } } } } else { if (getDB().isSupportsInlineDistinct()) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } else { query.append(BlogsEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck( query.toString(), BlogsEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); SQLQuery q = session.createSynchronizedSQLQuery(sql); q.setFirstResult(0); q.setMaxResults(2); if (getDB().isSupportsInlineDistinct()) { q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class); } else { q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class); } QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues(blogsEntry)) { qPos.add(orderByConditionValue); } } List list = q.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Removes all the blogs entries where groupId = ? and displayDate > ? and status = ? from the database. * * @param groupId the group ID * @param displayDate the display date * @param status the status */ @Override public void removeByG_GtD_S(long groupId, Date displayDate, int status) { for (BlogsEntry blogsEntry : findByG_GtD_S( groupId, displayDate, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(blogsEntry); } } /** * Returns the number of blogs entries where groupId = ? and displayDate > ? and status = ?. * * @param groupId the group ID * @param displayDate the display date * @param status the status * @return the number of matching blogs entries */ @Override public int countByG_GtD_S(long groupId, Date displayDate, int status) { FinderPath finderPath = _finderPathWithPaginationCountByG_GtD_S; Object[] finderArgs = new Object[] { groupId, _getTime(displayDate), status }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(4); query.append(_SQL_COUNT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_GTD_S_GROUPID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_GTD_S_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_GTD_S_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_G_GTD_S_STATUS_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); } /** * Returns the number of blogs entries that the user has permission to view where groupId = ? and displayDate > ? and status = ?. * * @param groupId the group ID * @param displayDate the display date * @param status the status * @return the number of matching blogs entries that the user has permission to view */ @Override public int filterCountByG_GtD_S( long groupId, Date displayDate, int status) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return countByG_GtD_S(groupId, displayDate, status); } StringBundler query = new StringBundler(4); query.append(_FILTER_SQL_COUNT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_GTD_S_GROUPID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_GTD_S_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_GTD_S_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_G_GTD_S_STATUS_2); String sql = InlineSQLHelperUtil.replacePermissionCheck( query.toString(), BlogsEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery q = session.createSynchronizedSQLQuery(sql); q.addScalar( COUNT_COLUMN_NAME, com.liferay.portal.kernel.dao.orm.Type.LONG); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); Long count = (Long)q.uniqueResult(); return count.intValue(); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } private static final String _FINDER_COLUMN_G_GTD_S_GROUPID_2 = "blogsEntry.groupId = ? AND "; private static final String _FINDER_COLUMN_G_GTD_S_DISPLAYDATE_1 = "blogsEntry.displayDate IS NULL AND "; private static final String _FINDER_COLUMN_G_GTD_S_DISPLAYDATE_2 = "blogsEntry.displayDate > ? AND "; private static final String _FINDER_COLUMN_G_GTD_S_STATUS_2 = "blogsEntry.status = ?"; private FinderPath _finderPathWithPaginationFindByG_LtD_S; private FinderPath _finderPathWithPaginationCountByG_LtD_S; /** * Returns all the blogs entries where groupId = ? and displayDate < ? and status = ?. * * @param groupId the group ID * @param displayDate the display date * @param status the status * @return the matching blogs entries */ @Override public List findByG_LtD_S( long groupId, Date displayDate, int status) { return findByG_LtD_S( groupId, displayDate, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the blogs entries where groupId = ? and displayDate < ? 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param displayDate the display date * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @return the range of matching blogs entries */ @Override public List findByG_LtD_S( long groupId, Date displayDate, int status, int start, int end) { return findByG_LtD_S(groupId, displayDate, status, start, end, null); } /** * Returns an ordered range of all the blogs entries where groupId = ? and displayDate < ? 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param displayDate the display date * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching blogs entries */ @Override public List findByG_LtD_S( long groupId, Date displayDate, int status, int start, int end, OrderByComparator orderByComparator) { return findByG_LtD_S( groupId, displayDate, status, start, end, orderByComparator, true); } /** * Returns an ordered range of all the blogs entries where groupId = ? and displayDate < ? 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param displayDate the display date * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @param retrieveFromCache whether to retrieve from the finder cache * @return the ordered range of matching blogs entries */ @Override public List findByG_LtD_S( long groupId, Date displayDate, int status, int start, int end, OrderByComparator orderByComparator, boolean retrieveFromCache) { boolean pagination = true; FinderPath finderPath = null; Object[] finderArgs = null; finderPath = _finderPathWithPaginationFindByG_LtD_S; finderArgs = new Object[] { groupId, _getTime(displayDate), status, start, end, orderByComparator }; List list = null; if (retrieveFromCache) { list = (List)finderCache.getResult( finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (BlogsEntry blogsEntry : list) { if ((groupId != blogsEntry.getGroupId()) || (displayDate.getTime() <= blogsEntry.getDisplayDate().getTime()) || (status != blogsEntry.getStatus())) { list = null; break; } } } } if (list == null) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 5 + (orderByComparator.getOrderByFields().length * 2)); } else { query = new StringBundler(5); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_LTD_S_GROUPID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_LTD_S_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_LTD_S_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_G_LTD_S_STATUS_2); if (orderByComparator != null) { appendOrderByComparator( query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); if (!pagination) { list = (List)QueryUtil.list( q, getDialect(), start, end, false); Collections.sort(list); list = Collections.unmodifiableList(list); } else { list = (List)QueryUtil.list( q, getDialect(), start, end); } cacheResult(list); finderCache.putResult(finderPath, finderArgs, list); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; } /** * Returns the first blogs entry in the ordered set where groupId = ? and displayDate < ? and status = ?. * * @param groupId the group ID * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByG_LtD_S_First( long groupId, Date displayDate, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByG_LtD_S_First( groupId, displayDate, status, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(8); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("groupId="); msg.append(groupId); msg.append(", displayDate="); msg.append(displayDate); msg.append(", status="); msg.append(status); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the first blogs entry in the ordered set where groupId = ? and displayDate < ? and status = ?. * * @param groupId the group ID * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry fetchByG_LtD_S_First( long groupId, Date displayDate, int status, OrderByComparator orderByComparator) { List list = findByG_LtD_S( groupId, displayDate, status, 0, 1, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the last blogs entry in the ordered set where groupId = ? and displayDate < ? and status = ?. * * @param groupId the group ID * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByG_LtD_S_Last( long groupId, Date displayDate, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByG_LtD_S_Last( groupId, displayDate, status, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(8); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("groupId="); msg.append(groupId); msg.append(", displayDate="); msg.append(displayDate); msg.append(", status="); msg.append(status); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the last blogs entry in the ordered set where groupId = ? and displayDate < ? and status = ?. * * @param groupId the group ID * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry fetchByG_LtD_S_Last( long groupId, Date displayDate, int status, OrderByComparator orderByComparator) { int count = countByG_LtD_S(groupId, displayDate, status); if (count == 0) { return null; } List list = findByG_LtD_S( groupId, displayDate, status, count - 1, count, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the blogs entries before and after the current blogs entry in the ordered set where groupId = ? and displayDate < ? and status = ?. * * @param entryId the primary key of the current blogs entry * @param groupId the group ID * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the previous, current, and next blogs entry * @throws NoSuchEntryException if a blogs entry with the primary key could not be found */ @Override public BlogsEntry[] findByG_LtD_S_PrevAndNext( long entryId, long groupId, Date displayDate, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BlogsEntry[] array = new BlogsEntryImpl[3]; array[0] = getByG_LtD_S_PrevAndNext( session, blogsEntry, groupId, displayDate, status, orderByComparator, true); array[1] = blogsEntry; array[2] = getByG_LtD_S_PrevAndNext( session, blogsEntry, groupId, displayDate, status, orderByComparator, false); return array; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } protected BlogsEntry getByG_LtD_S_PrevAndNext( Session session, BlogsEntry blogsEntry, long groupId, Date displayDate, int status, OrderByComparator orderByComparator, boolean previous) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 6 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(5); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_LTD_S_GROUPID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_LTD_S_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_LTD_S_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_G_LTD_S_STATUS_2); if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { query.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByConditionFields[i]); if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN_HAS_NEXT); } else { query.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN); } else { query.append(WHERE_LESSER_THAN); } } } query.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByFields[i]); if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC_HAS_NEXT); } else { query.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC); } else { query.append(ORDER_BY_DESC); } } } } else { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Query q = session.createQuery(sql); q.setFirstResult(0); q.setMaxResults(2); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues(blogsEntry)) { qPos.add(orderByConditionValue); } } List list = q.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Returns all the blogs entries that the user has permission to view where groupId = ? and displayDate < ? and status = ?. * * @param groupId the group ID * @param displayDate the display date * @param status the status * @return the matching blogs entries that the user has permission to view */ @Override public List filterFindByG_LtD_S( long groupId, Date displayDate, int status) { return filterFindByG_LtD_S( groupId, displayDate, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the blogs entries that the user has permission to view where groupId = ? and displayDate < ? 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param displayDate the display date * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @return the range of matching blogs entries that the user has permission to view */ @Override public List filterFindByG_LtD_S( long groupId, Date displayDate, int status, int start, int end) { return filterFindByG_LtD_S( groupId, displayDate, status, start, end, null); } /** * Returns an ordered range of all the blogs entries that the user has permissions to view where groupId = ? and displayDate < ? 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param displayDate the display date * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching blogs entries that the user has permission to view */ @Override public List filterFindByG_LtD_S( long groupId, Date displayDate, int status, int start, int end, OrderByComparator orderByComparator) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByG_LtD_S( groupId, displayDate, status, start, end, orderByComparator); } StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 5 + (orderByComparator.getOrderByFields().length * 2)); } else { query = new StringBundler(6); } if (getDB().isSupportsInlineDistinct()) { query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE); } else { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1); } query.append(_FINDER_COLUMN_G_LTD_S_GROUPID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_LTD_S_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_LTD_S_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_G_LTD_S_STATUS_2); if (!getDB().isSupportsInlineDistinct()) { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { if (getDB().isSupportsInlineDistinct()) { appendOrderByComparator( query, _ORDER_BY_ENTITY_ALIAS, orderByComparator, true); } else { appendOrderByComparator( query, _ORDER_BY_ENTITY_TABLE, orderByComparator, true); } } else { if (getDB().isSupportsInlineDistinct()) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } else { query.append(BlogsEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck( query.toString(), BlogsEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery q = session.createSynchronizedSQLQuery(sql); if (getDB().isSupportsInlineDistinct()) { q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class); } else { q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class); } QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); return (List)QueryUtil.list( q, getDialect(), start, end); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } /** * Returns the blogs entries before and after the current blogs entry in the ordered set of blogs entries that the user has permission to view where groupId = ? and displayDate < ? and status = ?. * * @param entryId the primary key of the current blogs entry * @param groupId the group ID * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the previous, current, and next blogs entry * @throws NoSuchEntryException if a blogs entry with the primary key could not be found */ @Override public BlogsEntry[] filterFindByG_LtD_S_PrevAndNext( long entryId, long groupId, Date displayDate, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByG_LtD_S_PrevAndNext( entryId, groupId, displayDate, status, orderByComparator); } BlogsEntry blogsEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BlogsEntry[] array = new BlogsEntryImpl[3]; array[0] = filterGetByG_LtD_S_PrevAndNext( session, blogsEntry, groupId, displayDate, status, orderByComparator, true); array[1] = blogsEntry; array[2] = filterGetByG_LtD_S_PrevAndNext( session, blogsEntry, groupId, displayDate, status, orderByComparator, false); return array; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } protected BlogsEntry filterGetByG_LtD_S_PrevAndNext( Session session, BlogsEntry blogsEntry, long groupId, Date displayDate, int status, OrderByComparator orderByComparator, boolean previous) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 7 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(6); } if (getDB().isSupportsInlineDistinct()) { query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE); } else { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1); } query.append(_FINDER_COLUMN_G_LTD_S_GROUPID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_LTD_S_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_LTD_S_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_G_LTD_S_STATUS_2); if (!getDB().isSupportsInlineDistinct()) { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { query.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { if (getDB().isSupportsInlineDistinct()) { query.append( getColumnName( _ORDER_BY_ENTITY_ALIAS, orderByConditionFields[i], true)); } else { query.append( getColumnName( _ORDER_BY_ENTITY_TABLE, orderByConditionFields[i], true)); } if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN_HAS_NEXT); } else { query.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN); } else { query.append(WHERE_LESSER_THAN); } } } query.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { if (getDB().isSupportsInlineDistinct()) { query.append( getColumnName( _ORDER_BY_ENTITY_ALIAS, orderByFields[i], true)); } else { query.append( getColumnName( _ORDER_BY_ENTITY_TABLE, orderByFields[i], true)); } if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC_HAS_NEXT); } else { query.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC); } else { query.append(ORDER_BY_DESC); } } } } else { if (getDB().isSupportsInlineDistinct()) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } else { query.append(BlogsEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck( query.toString(), BlogsEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); SQLQuery q = session.createSynchronizedSQLQuery(sql); q.setFirstResult(0); q.setMaxResults(2); if (getDB().isSupportsInlineDistinct()) { q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class); } else { q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class); } QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues(blogsEntry)) { qPos.add(orderByConditionValue); } } List list = q.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Removes all the blogs entries where groupId = ? and displayDate < ? and status = ? from the database. * * @param groupId the group ID * @param displayDate the display date * @param status the status */ @Override public void removeByG_LtD_S(long groupId, Date displayDate, int status) { for (BlogsEntry blogsEntry : findByG_LtD_S( groupId, displayDate, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(blogsEntry); } } /** * Returns the number of blogs entries where groupId = ? and displayDate < ? and status = ?. * * @param groupId the group ID * @param displayDate the display date * @param status the status * @return the number of matching blogs entries */ @Override public int countByG_LtD_S(long groupId, Date displayDate, int status) { FinderPath finderPath = _finderPathWithPaginationCountByG_LtD_S; Object[] finderArgs = new Object[] { groupId, _getTime(displayDate), status }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(4); query.append(_SQL_COUNT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_LTD_S_GROUPID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_LTD_S_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_LTD_S_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_G_LTD_S_STATUS_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); } /** * Returns the number of blogs entries that the user has permission to view where groupId = ? and displayDate < ? and status = ?. * * @param groupId the group ID * @param displayDate the display date * @param status the status * @return the number of matching blogs entries that the user has permission to view */ @Override public int filterCountByG_LtD_S( long groupId, Date displayDate, int status) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return countByG_LtD_S(groupId, displayDate, status); } StringBundler query = new StringBundler(4); query.append(_FILTER_SQL_COUNT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_LTD_S_GROUPID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_LTD_S_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_LTD_S_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_G_LTD_S_STATUS_2); String sql = InlineSQLHelperUtil.replacePermissionCheck( query.toString(), BlogsEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery q = session.createSynchronizedSQLQuery(sql); q.addScalar( COUNT_COLUMN_NAME, com.liferay.portal.kernel.dao.orm.Type.LONG); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); Long count = (Long)q.uniqueResult(); return count.intValue(); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } private static final String _FINDER_COLUMN_G_LTD_S_GROUPID_2 = "blogsEntry.groupId = ? AND "; private static final String _FINDER_COLUMN_G_LTD_S_DISPLAYDATE_1 = "blogsEntry.displayDate IS NULL AND "; private static final String _FINDER_COLUMN_G_LTD_S_DISPLAYDATE_2 = "blogsEntry.displayDate < ? AND "; private static final String _FINDER_COLUMN_G_LTD_S_STATUS_2 = "blogsEntry.status = ?"; private FinderPath _finderPathWithPaginationFindByG_LtD_NotS; private FinderPath _finderPathWithPaginationCountByG_LtD_NotS; /** * Returns all the blogs entries where groupId = ? and displayDate < ? and status ≠ ?. * * @param groupId the group ID * @param displayDate the display date * @param status the status * @return the matching blogs entries */ @Override public List findByG_LtD_NotS( long groupId, Date displayDate, int status) { return findByG_LtD_NotS( groupId, displayDate, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the blogs entries where groupId = ? and displayDate < ? 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param displayDate the display date * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @return the range of matching blogs entries */ @Override public List findByG_LtD_NotS( long groupId, Date displayDate, int status, int start, int end) { return findByG_LtD_NotS(groupId, displayDate, status, start, end, null); } /** * Returns an ordered range of all the blogs entries where groupId = ? and displayDate < ? 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param displayDate the display date * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching blogs entries */ @Override public List findByG_LtD_NotS( long groupId, Date displayDate, int status, int start, int end, OrderByComparator orderByComparator) { return findByG_LtD_NotS( groupId, displayDate, status, start, end, orderByComparator, true); } /** * Returns an ordered range of all the blogs entries where groupId = ? and displayDate < ? 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param displayDate the display date * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @param retrieveFromCache whether to retrieve from the finder cache * @return the ordered range of matching blogs entries */ @Override public List findByG_LtD_NotS( long groupId, Date displayDate, int status, int start, int end, OrderByComparator orderByComparator, boolean retrieveFromCache) { boolean pagination = true; FinderPath finderPath = null; Object[] finderArgs = null; finderPath = _finderPathWithPaginationFindByG_LtD_NotS; finderArgs = new Object[] { groupId, _getTime(displayDate), status, start, end, orderByComparator }; List list = null; if (retrieveFromCache) { list = (List)finderCache.getResult( finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (BlogsEntry blogsEntry : list) { if ((groupId != blogsEntry.getGroupId()) || (displayDate.getTime() <= blogsEntry.getDisplayDate().getTime()) || (status == blogsEntry.getStatus())) { list = null; break; } } } } if (list == null) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 5 + (orderByComparator.getOrderByFields().length * 2)); } else { query = new StringBundler(5); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_LTD_NOTS_GROUPID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_LTD_NOTS_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_LTD_NOTS_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_G_LTD_NOTS_STATUS_2); if (orderByComparator != null) { appendOrderByComparator( query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); if (!pagination) { list = (List)QueryUtil.list( q, getDialect(), start, end, false); Collections.sort(list); list = Collections.unmodifiableList(list); } else { list = (List)QueryUtil.list( q, getDialect(), start, end); } cacheResult(list); finderCache.putResult(finderPath, finderArgs, list); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; } /** * Returns the first blogs entry in the ordered set where groupId = ? and displayDate < ? and status ≠ ?. * * @param groupId the group ID * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByG_LtD_NotS_First( long groupId, Date displayDate, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByG_LtD_NotS_First( groupId, displayDate, status, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(8); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("groupId="); msg.append(groupId); msg.append(", displayDate="); msg.append(displayDate); msg.append(", status="); msg.append(status); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the first blogs entry in the ordered set where groupId = ? and displayDate < ? and status ≠ ?. * * @param groupId the group ID * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry fetchByG_LtD_NotS_First( long groupId, Date displayDate, int status, OrderByComparator orderByComparator) { List list = findByG_LtD_NotS( groupId, displayDate, status, 0, 1, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the last blogs entry in the ordered set where groupId = ? and displayDate < ? and status ≠ ?. * * @param groupId the group ID * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByG_LtD_NotS_Last( long groupId, Date displayDate, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByG_LtD_NotS_Last( groupId, displayDate, status, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(8); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("groupId="); msg.append(groupId); msg.append(", displayDate="); msg.append(displayDate); msg.append(", status="); msg.append(status); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the last blogs entry in the ordered set where groupId = ? and displayDate < ? and status ≠ ?. * * @param groupId the group ID * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry fetchByG_LtD_NotS_Last( long groupId, Date displayDate, int status, OrderByComparator orderByComparator) { int count = countByG_LtD_NotS(groupId, displayDate, status); if (count == 0) { return null; } List list = findByG_LtD_NotS( groupId, displayDate, status, count - 1, count, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the blogs entries before and after the current blogs entry in the ordered set where groupId = ? and displayDate < ? and status ≠ ?. * * @param entryId the primary key of the current blogs entry * @param groupId the group ID * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the previous, current, and next blogs entry * @throws NoSuchEntryException if a blogs entry with the primary key could not be found */ @Override public BlogsEntry[] findByG_LtD_NotS_PrevAndNext( long entryId, long groupId, Date displayDate, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BlogsEntry[] array = new BlogsEntryImpl[3]; array[0] = getByG_LtD_NotS_PrevAndNext( session, blogsEntry, groupId, displayDate, status, orderByComparator, true); array[1] = blogsEntry; array[2] = getByG_LtD_NotS_PrevAndNext( session, blogsEntry, groupId, displayDate, status, orderByComparator, false); return array; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } protected BlogsEntry getByG_LtD_NotS_PrevAndNext( Session session, BlogsEntry blogsEntry, long groupId, Date displayDate, int status, OrderByComparator orderByComparator, boolean previous) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 6 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(5); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_LTD_NOTS_GROUPID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_LTD_NOTS_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_LTD_NOTS_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_G_LTD_NOTS_STATUS_2); if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { query.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByConditionFields[i]); if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN_HAS_NEXT); } else { query.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN); } else { query.append(WHERE_LESSER_THAN); } } } query.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByFields[i]); if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC_HAS_NEXT); } else { query.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC); } else { query.append(ORDER_BY_DESC); } } } } else { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Query q = session.createQuery(sql); q.setFirstResult(0); q.setMaxResults(2); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues(blogsEntry)) { qPos.add(orderByConditionValue); } } List list = q.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Returns all the blogs entries that the user has permission to view where groupId = ? and displayDate < ? and status ≠ ?. * * @param groupId the group ID * @param displayDate the display date * @param status the status * @return the matching blogs entries that the user has permission to view */ @Override public List filterFindByG_LtD_NotS( long groupId, Date displayDate, int status) { return filterFindByG_LtD_NotS( groupId, displayDate, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the blogs entries that the user has permission to view where groupId = ? and displayDate < ? 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param displayDate the display date * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @return the range of matching blogs entries that the user has permission to view */ @Override public List filterFindByG_LtD_NotS( long groupId, Date displayDate, int status, int start, int end) { return filterFindByG_LtD_NotS( groupId, displayDate, status, start, end, null); } /** * Returns an ordered range of all the blogs entries that the user has permissions to view where groupId = ? and displayDate < ? 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param displayDate the display date * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching blogs entries that the user has permission to view */ @Override public List filterFindByG_LtD_NotS( long groupId, Date displayDate, int status, int start, int end, OrderByComparator orderByComparator) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByG_LtD_NotS( groupId, displayDate, status, start, end, orderByComparator); } StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 5 + (orderByComparator.getOrderByFields().length * 2)); } else { query = new StringBundler(6); } if (getDB().isSupportsInlineDistinct()) { query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE); } else { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1); } query.append(_FINDER_COLUMN_G_LTD_NOTS_GROUPID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_LTD_NOTS_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_LTD_NOTS_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_G_LTD_NOTS_STATUS_2); if (!getDB().isSupportsInlineDistinct()) { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { if (getDB().isSupportsInlineDistinct()) { appendOrderByComparator( query, _ORDER_BY_ENTITY_ALIAS, orderByComparator, true); } else { appendOrderByComparator( query, _ORDER_BY_ENTITY_TABLE, orderByComparator, true); } } else { if (getDB().isSupportsInlineDistinct()) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } else { query.append(BlogsEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck( query.toString(), BlogsEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery q = session.createSynchronizedSQLQuery(sql); if (getDB().isSupportsInlineDistinct()) { q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class); } else { q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class); } QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); return (List)QueryUtil.list( q, getDialect(), start, end); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } /** * Returns the blogs entries before and after the current blogs entry in the ordered set of blogs entries that the user has permission to view where groupId = ? and displayDate < ? and status ≠ ?. * * @param entryId the primary key of the current blogs entry * @param groupId the group ID * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the previous, current, and next blogs entry * @throws NoSuchEntryException if a blogs entry with the primary key could not be found */ @Override public BlogsEntry[] filterFindByG_LtD_NotS_PrevAndNext( long entryId, long groupId, Date displayDate, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByG_LtD_NotS_PrevAndNext( entryId, groupId, displayDate, status, orderByComparator); } BlogsEntry blogsEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BlogsEntry[] array = new BlogsEntryImpl[3]; array[0] = filterGetByG_LtD_NotS_PrevAndNext( session, blogsEntry, groupId, displayDate, status, orderByComparator, true); array[1] = blogsEntry; array[2] = filterGetByG_LtD_NotS_PrevAndNext( session, blogsEntry, groupId, displayDate, status, orderByComparator, false); return array; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } protected BlogsEntry filterGetByG_LtD_NotS_PrevAndNext( Session session, BlogsEntry blogsEntry, long groupId, Date displayDate, int status, OrderByComparator orderByComparator, boolean previous) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 7 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(6); } if (getDB().isSupportsInlineDistinct()) { query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE); } else { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1); } query.append(_FINDER_COLUMN_G_LTD_NOTS_GROUPID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_LTD_NOTS_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_LTD_NOTS_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_G_LTD_NOTS_STATUS_2); if (!getDB().isSupportsInlineDistinct()) { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { query.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { if (getDB().isSupportsInlineDistinct()) { query.append( getColumnName( _ORDER_BY_ENTITY_ALIAS, orderByConditionFields[i], true)); } else { query.append( getColumnName( _ORDER_BY_ENTITY_TABLE, orderByConditionFields[i], true)); } if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN_HAS_NEXT); } else { query.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN); } else { query.append(WHERE_LESSER_THAN); } } } query.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { if (getDB().isSupportsInlineDistinct()) { query.append( getColumnName( _ORDER_BY_ENTITY_ALIAS, orderByFields[i], true)); } else { query.append( getColumnName( _ORDER_BY_ENTITY_TABLE, orderByFields[i], true)); } if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC_HAS_NEXT); } else { query.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC); } else { query.append(ORDER_BY_DESC); } } } } else { if (getDB().isSupportsInlineDistinct()) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } else { query.append(BlogsEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck( query.toString(), BlogsEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); SQLQuery q = session.createSynchronizedSQLQuery(sql); q.setFirstResult(0); q.setMaxResults(2); if (getDB().isSupportsInlineDistinct()) { q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class); } else { q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class); } QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues(blogsEntry)) { qPos.add(orderByConditionValue); } } List list = q.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Removes all the blogs entries where groupId = ? and displayDate < ? and status ≠ ? from the database. * * @param groupId the group ID * @param displayDate the display date * @param status the status */ @Override public void removeByG_LtD_NotS(long groupId, Date displayDate, int status) { for (BlogsEntry blogsEntry : findByG_LtD_NotS( groupId, displayDate, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(blogsEntry); } } /** * Returns the number of blogs entries where groupId = ? and displayDate < ? and status ≠ ?. * * @param groupId the group ID * @param displayDate the display date * @param status the status * @return the number of matching blogs entries */ @Override public int countByG_LtD_NotS(long groupId, Date displayDate, int status) { FinderPath finderPath = _finderPathWithPaginationCountByG_LtD_NotS; Object[] finderArgs = new Object[] { groupId, _getTime(displayDate), status }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(4); query.append(_SQL_COUNT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_LTD_NOTS_GROUPID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_LTD_NOTS_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_LTD_NOTS_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_G_LTD_NOTS_STATUS_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); } /** * Returns the number of blogs entries that the user has permission to view where groupId = ? and displayDate < ? and status ≠ ?. * * @param groupId the group ID * @param displayDate the display date * @param status the status * @return the number of matching blogs entries that the user has permission to view */ @Override public int filterCountByG_LtD_NotS( long groupId, Date displayDate, int status) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return countByG_LtD_NotS(groupId, displayDate, status); } StringBundler query = new StringBundler(4); query.append(_FILTER_SQL_COUNT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_LTD_NOTS_GROUPID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_LTD_NOTS_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_LTD_NOTS_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_G_LTD_NOTS_STATUS_2); String sql = InlineSQLHelperUtil.replacePermissionCheck( query.toString(), BlogsEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery q = session.createSynchronizedSQLQuery(sql); q.addScalar( COUNT_COLUMN_NAME, com.liferay.portal.kernel.dao.orm.Type.LONG); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); Long count = (Long)q.uniqueResult(); return count.intValue(); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } private static final String _FINDER_COLUMN_G_LTD_NOTS_GROUPID_2 = "blogsEntry.groupId = ? AND "; private static final String _FINDER_COLUMN_G_LTD_NOTS_DISPLAYDATE_1 = "blogsEntry.displayDate IS NULL AND "; private static final String _FINDER_COLUMN_G_LTD_NOTS_DISPLAYDATE_2 = "blogsEntry.displayDate < ? AND "; private static final String _FINDER_COLUMN_G_LTD_NOTS_STATUS_2 = "blogsEntry.status != ?"; private FinderPath _finderPathWithPaginationFindByC_U_S; private FinderPath _finderPathWithoutPaginationFindByC_U_S; private FinderPath _finderPathCountByC_U_S; /** * Returns all the blogs entries where companyId = ? and userId = ? and status = ?. * * @param companyId the company ID * @param userId the user ID * @param status the status * @return the matching blogs entries */ @Override public List findByC_U_S( long companyId, long userId, int status) { return findByC_U_S( companyId, userId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the blogs entries where companyId = ? 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param companyId the company ID * @param userId the user ID * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @return the range of matching blogs entries */ @Override public List findByC_U_S( long companyId, long userId, int status, int start, int end) { return findByC_U_S(companyId, userId, status, start, end, null); } /** * Returns an ordered range of all the blogs entries where companyId = ? 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param companyId the company ID * @param userId the user ID * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching blogs entries */ @Override public List findByC_U_S( long companyId, long userId, int status, int start, int end, OrderByComparator orderByComparator) { return findByC_U_S( companyId, userId, status, start, end, orderByComparator, true); } /** * Returns an ordered range of all the blogs entries where companyId = ? 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param companyId the company ID * @param userId the user ID * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @param retrieveFromCache whether to retrieve from the finder cache * @return the ordered range of matching blogs entries */ @Override public List findByC_U_S( long companyId, long userId, int status, int start, int end, OrderByComparator orderByComparator, boolean retrieveFromCache) { boolean pagination = true; FinderPath finderPath = null; Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { pagination = false; finderPath = _finderPathWithoutPaginationFindByC_U_S; finderArgs = new Object[] {companyId, userId, status}; } else { finderPath = _finderPathWithPaginationFindByC_U_S; finderArgs = new Object[] { companyId, userId, status, start, end, orderByComparator }; } List list = null; if (retrieveFromCache) { list = (List)finderCache.getResult( finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (BlogsEntry blogsEntry : list) { if ((companyId != blogsEntry.getCompanyId()) || (userId != blogsEntry.getUserId()) || (status != blogsEntry.getStatus())) { list = null; break; } } } } if (list == null) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 5 + (orderByComparator.getOrderByFields().length * 2)); } else { query = new StringBundler(5); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_C_U_S_COMPANYID_2); query.append(_FINDER_COLUMN_C_U_S_USERID_2); query.append(_FINDER_COLUMN_C_U_S_STATUS_2); if (orderByComparator != null) { appendOrderByComparator( query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(companyId); qPos.add(userId); qPos.add(status); if (!pagination) { list = (List)QueryUtil.list( q, getDialect(), start, end, false); Collections.sort(list); list = Collections.unmodifiableList(list); } else { list = (List)QueryUtil.list( q, getDialect(), start, end); } cacheResult(list); finderCache.putResult(finderPath, finderArgs, list); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; } /** * Returns the first blogs entry in the ordered set where companyId = ? and userId = ? and status = ?. * * @param companyId the company 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 blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByC_U_S_First( long companyId, long userId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByC_U_S_First( companyId, userId, status, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(8); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("companyId="); msg.append(companyId); msg.append(", userId="); msg.append(userId); msg.append(", status="); msg.append(status); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the first blogs entry in the ordered set where companyId = ? and userId = ? and status = ?. * * @param companyId the company 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 blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry fetchByC_U_S_First( long companyId, long userId, int status, OrderByComparator orderByComparator) { List list = findByC_U_S( companyId, userId, status, 0, 1, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the last blogs entry in the ordered set where companyId = ? and userId = ? and status = ?. * * @param companyId the company 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 blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByC_U_S_Last( long companyId, long userId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByC_U_S_Last( companyId, userId, status, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(8); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("companyId="); msg.append(companyId); msg.append(", userId="); msg.append(userId); msg.append(", status="); msg.append(status); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the last blogs entry in the ordered set where companyId = ? and userId = ? and status = ?. * * @param companyId the company 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 blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry fetchByC_U_S_Last( long companyId, long userId, int status, OrderByComparator orderByComparator) { int count = countByC_U_S(companyId, userId, status); if (count == 0) { return null; } List list = findByC_U_S( companyId, userId, status, count - 1, count, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the blogs entries before and after the current blogs entry in the ordered set where companyId = ? and userId = ? and status = ?. * * @param entryId the primary key of the current blogs entry * @param companyId the company 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 blogs entry * @throws NoSuchEntryException if a blogs entry with the primary key could not be found */ @Override public BlogsEntry[] findByC_U_S_PrevAndNext( long entryId, long companyId, long userId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BlogsEntry[] array = new BlogsEntryImpl[3]; array[0] = getByC_U_S_PrevAndNext( session, blogsEntry, companyId, userId, status, orderByComparator, true); array[1] = blogsEntry; array[2] = getByC_U_S_PrevAndNext( session, blogsEntry, companyId, userId, status, orderByComparator, false); return array; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } protected BlogsEntry getByC_U_S_PrevAndNext( Session session, BlogsEntry blogsEntry, long companyId, long userId, int status, OrderByComparator orderByComparator, boolean previous) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 6 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(5); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_C_U_S_COMPANYID_2); query.append(_FINDER_COLUMN_C_U_S_USERID_2); query.append(_FINDER_COLUMN_C_U_S_STATUS_2); if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { query.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByConditionFields[i]); if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN_HAS_NEXT); } else { query.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN); } else { query.append(WHERE_LESSER_THAN); } } } query.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByFields[i]); if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC_HAS_NEXT); } else { query.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC); } else { query.append(ORDER_BY_DESC); } } } } else { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Query q = session.createQuery(sql); q.setFirstResult(0); q.setMaxResults(2); QueryPos qPos = QueryPos.getInstance(q); qPos.add(companyId); qPos.add(userId); qPos.add(status); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues(blogsEntry)) { qPos.add(orderByConditionValue); } } List list = q.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Removes all the blogs entries where companyId = ? and userId = ? and status = ? from the database. * * @param companyId the company ID * @param userId the user ID * @param status the status */ @Override public void removeByC_U_S(long companyId, long userId, int status) { for (BlogsEntry blogsEntry : findByC_U_S( companyId, userId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(blogsEntry); } } /** * Returns the number of blogs entries where companyId = ? and userId = ? and status = ?. * * @param companyId the company ID * @param userId the user ID * @param status the status * @return the number of matching blogs entries */ @Override public int countByC_U_S(long companyId, long userId, int status) { FinderPath finderPath = _finderPathCountByC_U_S; Object[] finderArgs = new Object[] {companyId, userId, status}; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(4); query.append(_SQL_COUNT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_C_U_S_COMPANYID_2); query.append(_FINDER_COLUMN_C_U_S_USERID_2); query.append(_FINDER_COLUMN_C_U_S_STATUS_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(companyId); qPos.add(userId); qPos.add(status); count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); } private static final String _FINDER_COLUMN_C_U_S_COMPANYID_2 = "blogsEntry.companyId = ? AND "; private static final String _FINDER_COLUMN_C_U_S_USERID_2 = "blogsEntry.userId = ? AND "; private static final String _FINDER_COLUMN_C_U_S_STATUS_2 = "blogsEntry.status = ?"; private FinderPath _finderPathWithPaginationFindByC_U_NotS; private FinderPath _finderPathWithPaginationCountByC_U_NotS; /** * Returns all the blogs entries where companyId = ? and userId = ? and status ≠ ?. * * @param companyId the company ID * @param userId the user ID * @param status the status * @return the matching blogs entries */ @Override public List findByC_U_NotS( long companyId, long userId, int status) { return findByC_U_NotS( companyId, userId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the blogs entries where companyId = ? 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param companyId the company ID * @param userId the user ID * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @return the range of matching blogs entries */ @Override public List findByC_U_NotS( long companyId, long userId, int status, int start, int end) { return findByC_U_NotS(companyId, userId, status, start, end, null); } /** * Returns an ordered range of all the blogs entries where companyId = ? 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param companyId the company ID * @param userId the user ID * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching blogs entries */ @Override public List findByC_U_NotS( long companyId, long userId, int status, int start, int end, OrderByComparator orderByComparator) { return findByC_U_NotS( companyId, userId, status, start, end, orderByComparator, true); } /** * Returns an ordered range of all the blogs entries where companyId = ? 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param companyId the company ID * @param userId the user ID * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @param retrieveFromCache whether to retrieve from the finder cache * @return the ordered range of matching blogs entries */ @Override public List findByC_U_NotS( long companyId, long userId, int status, int start, int end, OrderByComparator orderByComparator, boolean retrieveFromCache) { boolean pagination = true; FinderPath finderPath = null; Object[] finderArgs = null; finderPath = _finderPathWithPaginationFindByC_U_NotS; finderArgs = new Object[] { companyId, userId, status, start, end, orderByComparator }; List list = null; if (retrieveFromCache) { list = (List)finderCache.getResult( finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (BlogsEntry blogsEntry : list) { if ((companyId != blogsEntry.getCompanyId()) || (userId != blogsEntry.getUserId()) || (status == blogsEntry.getStatus())) { list = null; break; } } } } if (list == null) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 5 + (orderByComparator.getOrderByFields().length * 2)); } else { query = new StringBundler(5); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_C_U_NOTS_COMPANYID_2); query.append(_FINDER_COLUMN_C_U_NOTS_USERID_2); query.append(_FINDER_COLUMN_C_U_NOTS_STATUS_2); if (orderByComparator != null) { appendOrderByComparator( query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(companyId); qPos.add(userId); qPos.add(status); if (!pagination) { list = (List)QueryUtil.list( q, getDialect(), start, end, false); Collections.sort(list); list = Collections.unmodifiableList(list); } else { list = (List)QueryUtil.list( q, getDialect(), start, end); } cacheResult(list); finderCache.putResult(finderPath, finderArgs, list); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; } /** * Returns the first blogs entry in the ordered set where companyId = ? and userId = ? and status ≠ ?. * * @param companyId the company 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 blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByC_U_NotS_First( long companyId, long userId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByC_U_NotS_First( companyId, userId, status, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(8); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("companyId="); msg.append(companyId); msg.append(", userId="); msg.append(userId); msg.append(", status="); msg.append(status); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the first blogs entry in the ordered set where companyId = ? and userId = ? and status ≠ ?. * * @param companyId the company 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 blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry fetchByC_U_NotS_First( long companyId, long userId, int status, OrderByComparator orderByComparator) { List list = findByC_U_NotS( companyId, userId, status, 0, 1, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the last blogs entry in the ordered set where companyId = ? and userId = ? and status ≠ ?. * * @param companyId the company 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 blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByC_U_NotS_Last( long companyId, long userId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByC_U_NotS_Last( companyId, userId, status, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(8); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("companyId="); msg.append(companyId); msg.append(", userId="); msg.append(userId); msg.append(", status="); msg.append(status); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the last blogs entry in the ordered set where companyId = ? and userId = ? and status ≠ ?. * * @param companyId the company 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 blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry fetchByC_U_NotS_Last( long companyId, long userId, int status, OrderByComparator orderByComparator) { int count = countByC_U_NotS(companyId, userId, status); if (count == 0) { return null; } List list = findByC_U_NotS( companyId, userId, status, count - 1, count, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the blogs entries before and after the current blogs entry in the ordered set where companyId = ? and userId = ? and status ≠ ?. * * @param entryId the primary key of the current blogs entry * @param companyId the company 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 blogs entry * @throws NoSuchEntryException if a blogs entry with the primary key could not be found */ @Override public BlogsEntry[] findByC_U_NotS_PrevAndNext( long entryId, long companyId, long userId, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BlogsEntry[] array = new BlogsEntryImpl[3]; array[0] = getByC_U_NotS_PrevAndNext( session, blogsEntry, companyId, userId, status, orderByComparator, true); array[1] = blogsEntry; array[2] = getByC_U_NotS_PrevAndNext( session, blogsEntry, companyId, userId, status, orderByComparator, false); return array; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } protected BlogsEntry getByC_U_NotS_PrevAndNext( Session session, BlogsEntry blogsEntry, long companyId, long userId, int status, OrderByComparator orderByComparator, boolean previous) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 6 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(5); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_C_U_NOTS_COMPANYID_2); query.append(_FINDER_COLUMN_C_U_NOTS_USERID_2); query.append(_FINDER_COLUMN_C_U_NOTS_STATUS_2); if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { query.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByConditionFields[i]); if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN_HAS_NEXT); } else { query.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN); } else { query.append(WHERE_LESSER_THAN); } } } query.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByFields[i]); if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC_HAS_NEXT); } else { query.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC); } else { query.append(ORDER_BY_DESC); } } } } else { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Query q = session.createQuery(sql); q.setFirstResult(0); q.setMaxResults(2); QueryPos qPos = QueryPos.getInstance(q); qPos.add(companyId); qPos.add(userId); qPos.add(status); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues(blogsEntry)) { qPos.add(orderByConditionValue); } } List list = q.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Removes all the blogs entries where companyId = ? and userId = ? and status ≠ ? from the database. * * @param companyId the company ID * @param userId the user ID * @param status the status */ @Override public void removeByC_U_NotS(long companyId, long userId, int status) { for (BlogsEntry blogsEntry : findByC_U_NotS( companyId, userId, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(blogsEntry); } } /** * Returns the number of blogs entries where companyId = ? and userId = ? and status ≠ ?. * * @param companyId the company ID * @param userId the user ID * @param status the status * @return the number of matching blogs entries */ @Override public int countByC_U_NotS(long companyId, long userId, int status) { FinderPath finderPath = _finderPathWithPaginationCountByC_U_NotS; Object[] finderArgs = new Object[] {companyId, userId, status}; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(4); query.append(_SQL_COUNT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_C_U_NOTS_COMPANYID_2); query.append(_FINDER_COLUMN_C_U_NOTS_USERID_2); query.append(_FINDER_COLUMN_C_U_NOTS_STATUS_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(companyId); qPos.add(userId); qPos.add(status); count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); } private static final String _FINDER_COLUMN_C_U_NOTS_COMPANYID_2 = "blogsEntry.companyId = ? AND "; private static final String _FINDER_COLUMN_C_U_NOTS_USERID_2 = "blogsEntry.userId = ? AND "; private static final String _FINDER_COLUMN_C_U_NOTS_STATUS_2 = "blogsEntry.status != ?"; private FinderPath _finderPathWithPaginationFindByC_LtD_S; private FinderPath _finderPathWithPaginationCountByC_LtD_S; /** * Returns all the blogs entries where companyId = ? and displayDate < ? and status = ?. * * @param companyId the company ID * @param displayDate the display date * @param status the status * @return the matching blogs entries */ @Override public List findByC_LtD_S( long companyId, Date displayDate, int status) { return findByC_LtD_S( companyId, displayDate, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the blogs entries where companyId = ? and displayDate < ? 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param companyId the company ID * @param displayDate the display date * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @return the range of matching blogs entries */ @Override public List findByC_LtD_S( long companyId, Date displayDate, int status, int start, int end) { return findByC_LtD_S(companyId, displayDate, status, start, end, null); } /** * Returns an ordered range of all the blogs entries where companyId = ? and displayDate < ? 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param companyId the company ID * @param displayDate the display date * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching blogs entries */ @Override public List findByC_LtD_S( long companyId, Date displayDate, int status, int start, int end, OrderByComparator orderByComparator) { return findByC_LtD_S( companyId, displayDate, status, start, end, orderByComparator, true); } /** * Returns an ordered range of all the blogs entries where companyId = ? and displayDate < ? 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param companyId the company ID * @param displayDate the display date * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @param retrieveFromCache whether to retrieve from the finder cache * @return the ordered range of matching blogs entries */ @Override public List findByC_LtD_S( long companyId, Date displayDate, int status, int start, int end, OrderByComparator orderByComparator, boolean retrieveFromCache) { boolean pagination = true; FinderPath finderPath = null; Object[] finderArgs = null; finderPath = _finderPathWithPaginationFindByC_LtD_S; finderArgs = new Object[] { companyId, _getTime(displayDate), status, start, end, orderByComparator }; List list = null; if (retrieveFromCache) { list = (List)finderCache.getResult( finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (BlogsEntry blogsEntry : list) { if ((companyId != blogsEntry.getCompanyId()) || (displayDate.getTime() <= blogsEntry.getDisplayDate().getTime()) || (status != blogsEntry.getStatus())) { list = null; break; } } } } if (list == null) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 5 + (orderByComparator.getOrderByFields().length * 2)); } else { query = new StringBundler(5); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_C_LTD_S_COMPANYID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_C_LTD_S_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_C_LTD_S_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_C_LTD_S_STATUS_2); if (orderByComparator != null) { appendOrderByComparator( query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(companyId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); if (!pagination) { list = (List)QueryUtil.list( q, getDialect(), start, end, false); Collections.sort(list); list = Collections.unmodifiableList(list); } else { list = (List)QueryUtil.list( q, getDialect(), start, end); } cacheResult(list); finderCache.putResult(finderPath, finderArgs, list); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; } /** * Returns the first blogs entry in the ordered set where companyId = ? and displayDate < ? and status = ?. * * @param companyId the company ID * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByC_LtD_S_First( long companyId, Date displayDate, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByC_LtD_S_First( companyId, displayDate, status, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(8); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("companyId="); msg.append(companyId); msg.append(", displayDate="); msg.append(displayDate); msg.append(", status="); msg.append(status); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the first blogs entry in the ordered set where companyId = ? and displayDate < ? and status = ?. * * @param companyId the company ID * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry fetchByC_LtD_S_First( long companyId, Date displayDate, int status, OrderByComparator orderByComparator) { List list = findByC_LtD_S( companyId, displayDate, status, 0, 1, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the last blogs entry in the ordered set where companyId = ? and displayDate < ? and status = ?. * * @param companyId the company ID * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByC_LtD_S_Last( long companyId, Date displayDate, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByC_LtD_S_Last( companyId, displayDate, status, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(8); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("companyId="); msg.append(companyId); msg.append(", displayDate="); msg.append(displayDate); msg.append(", status="); msg.append(status); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the last blogs entry in the ordered set where companyId = ? and displayDate < ? and status = ?. * * @param companyId the company ID * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry fetchByC_LtD_S_Last( long companyId, Date displayDate, int status, OrderByComparator orderByComparator) { int count = countByC_LtD_S(companyId, displayDate, status); if (count == 0) { return null; } List list = findByC_LtD_S( companyId, displayDate, status, count - 1, count, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the blogs entries before and after the current blogs entry in the ordered set where companyId = ? and displayDate < ? and status = ?. * * @param entryId the primary key of the current blogs entry * @param companyId the company ID * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the previous, current, and next blogs entry * @throws NoSuchEntryException if a blogs entry with the primary key could not be found */ @Override public BlogsEntry[] findByC_LtD_S_PrevAndNext( long entryId, long companyId, Date displayDate, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BlogsEntry[] array = new BlogsEntryImpl[3]; array[0] = getByC_LtD_S_PrevAndNext( session, blogsEntry, companyId, displayDate, status, orderByComparator, true); array[1] = blogsEntry; array[2] = getByC_LtD_S_PrevAndNext( session, blogsEntry, companyId, displayDate, status, orderByComparator, false); return array; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } protected BlogsEntry getByC_LtD_S_PrevAndNext( Session session, BlogsEntry blogsEntry, long companyId, Date displayDate, int status, OrderByComparator orderByComparator, boolean previous) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 6 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(5); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_C_LTD_S_COMPANYID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_C_LTD_S_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_C_LTD_S_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_C_LTD_S_STATUS_2); if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { query.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByConditionFields[i]); if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN_HAS_NEXT); } else { query.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN); } else { query.append(WHERE_LESSER_THAN); } } } query.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByFields[i]); if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC_HAS_NEXT); } else { query.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC); } else { query.append(ORDER_BY_DESC); } } } } else { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Query q = session.createQuery(sql); q.setFirstResult(0); q.setMaxResults(2); QueryPos qPos = QueryPos.getInstance(q); qPos.add(companyId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues(blogsEntry)) { qPos.add(orderByConditionValue); } } List list = q.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Removes all the blogs entries where companyId = ? and displayDate < ? and status = ? from the database. * * @param companyId the company ID * @param displayDate the display date * @param status the status */ @Override public void removeByC_LtD_S(long companyId, Date displayDate, int status) { for (BlogsEntry blogsEntry : findByC_LtD_S( companyId, displayDate, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(blogsEntry); } } /** * Returns the number of blogs entries where companyId = ? and displayDate < ? and status = ?. * * @param companyId the company ID * @param displayDate the display date * @param status the status * @return the number of matching blogs entries */ @Override public int countByC_LtD_S(long companyId, Date displayDate, int status) { FinderPath finderPath = _finderPathWithPaginationCountByC_LtD_S; Object[] finderArgs = new Object[] { companyId, _getTime(displayDate), status }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(4); query.append(_SQL_COUNT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_C_LTD_S_COMPANYID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_C_LTD_S_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_C_LTD_S_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_C_LTD_S_STATUS_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(companyId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); } private static final String _FINDER_COLUMN_C_LTD_S_COMPANYID_2 = "blogsEntry.companyId = ? AND "; private static final String _FINDER_COLUMN_C_LTD_S_DISPLAYDATE_1 = "blogsEntry.displayDate IS NULL AND "; private static final String _FINDER_COLUMN_C_LTD_S_DISPLAYDATE_2 = "blogsEntry.displayDate < ? AND "; private static final String _FINDER_COLUMN_C_LTD_S_STATUS_2 = "blogsEntry.status = ?"; private FinderPath _finderPathWithPaginationFindByC_LtD_NotS; private FinderPath _finderPathWithPaginationCountByC_LtD_NotS; /** * Returns all the blogs entries where companyId = ? and displayDate < ? and status ≠ ?. * * @param companyId the company ID * @param displayDate the display date * @param status the status * @return the matching blogs entries */ @Override public List findByC_LtD_NotS( long companyId, Date displayDate, int status) { return findByC_LtD_NotS( companyId, displayDate, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the blogs entries where companyId = ? and displayDate < ? 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param companyId the company ID * @param displayDate the display date * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @return the range of matching blogs entries */ @Override public List findByC_LtD_NotS( long companyId, Date displayDate, int status, int start, int end) { return findByC_LtD_NotS( companyId, displayDate, status, start, end, null); } /** * Returns an ordered range of all the blogs entries where companyId = ? and displayDate < ? 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param companyId the company ID * @param displayDate the display date * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching blogs entries */ @Override public List findByC_LtD_NotS( long companyId, Date displayDate, int status, int start, int end, OrderByComparator orderByComparator) { return findByC_LtD_NotS( companyId, displayDate, status, start, end, orderByComparator, true); } /** * Returns an ordered range of all the blogs entries where companyId = ? and displayDate < ? 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param companyId the company ID * @param displayDate the display date * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @param retrieveFromCache whether to retrieve from the finder cache * @return the ordered range of matching blogs entries */ @Override public List findByC_LtD_NotS( long companyId, Date displayDate, int status, int start, int end, OrderByComparator orderByComparator, boolean retrieveFromCache) { boolean pagination = true; FinderPath finderPath = null; Object[] finderArgs = null; finderPath = _finderPathWithPaginationFindByC_LtD_NotS; finderArgs = new Object[] { companyId, _getTime(displayDate), status, start, end, orderByComparator }; List list = null; if (retrieveFromCache) { list = (List)finderCache.getResult( finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (BlogsEntry blogsEntry : list) { if ((companyId != blogsEntry.getCompanyId()) || (displayDate.getTime() <= blogsEntry.getDisplayDate().getTime()) || (status == blogsEntry.getStatus())) { list = null; break; } } } } if (list == null) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 5 + (orderByComparator.getOrderByFields().length * 2)); } else { query = new StringBundler(5); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_C_LTD_NOTS_COMPANYID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_C_LTD_NOTS_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_C_LTD_NOTS_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_C_LTD_NOTS_STATUS_2); if (orderByComparator != null) { appendOrderByComparator( query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(companyId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); if (!pagination) { list = (List)QueryUtil.list( q, getDialect(), start, end, false); Collections.sort(list); list = Collections.unmodifiableList(list); } else { list = (List)QueryUtil.list( q, getDialect(), start, end); } cacheResult(list); finderCache.putResult(finderPath, finderArgs, list); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; } /** * Returns the first blogs entry in the ordered set where companyId = ? and displayDate < ? and status ≠ ?. * * @param companyId the company ID * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByC_LtD_NotS_First( long companyId, Date displayDate, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByC_LtD_NotS_First( companyId, displayDate, status, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(8); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("companyId="); msg.append(companyId); msg.append(", displayDate="); msg.append(displayDate); msg.append(", status="); msg.append(status); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the first blogs entry in the ordered set where companyId = ? and displayDate < ? and status ≠ ?. * * @param companyId the company ID * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry fetchByC_LtD_NotS_First( long companyId, Date displayDate, int status, OrderByComparator orderByComparator) { List list = findByC_LtD_NotS( companyId, displayDate, status, 0, 1, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the last blogs entry in the ordered set where companyId = ? and displayDate < ? and status ≠ ?. * * @param companyId the company ID * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByC_LtD_NotS_Last( long companyId, Date displayDate, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByC_LtD_NotS_Last( companyId, displayDate, status, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(8); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("companyId="); msg.append(companyId); msg.append(", displayDate="); msg.append(displayDate); msg.append(", status="); msg.append(status); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the last blogs entry in the ordered set where companyId = ? and displayDate < ? and status ≠ ?. * * @param companyId the company ID * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry fetchByC_LtD_NotS_Last( long companyId, Date displayDate, int status, OrderByComparator orderByComparator) { int count = countByC_LtD_NotS(companyId, displayDate, status); if (count == 0) { return null; } List list = findByC_LtD_NotS( companyId, displayDate, status, count - 1, count, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the blogs entries before and after the current blogs entry in the ordered set where companyId = ? and displayDate < ? and status ≠ ?. * * @param entryId the primary key of the current blogs entry * @param companyId the company ID * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the previous, current, and next blogs entry * @throws NoSuchEntryException if a blogs entry with the primary key could not be found */ @Override public BlogsEntry[] findByC_LtD_NotS_PrevAndNext( long entryId, long companyId, Date displayDate, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BlogsEntry[] array = new BlogsEntryImpl[3]; array[0] = getByC_LtD_NotS_PrevAndNext( session, blogsEntry, companyId, displayDate, status, orderByComparator, true); array[1] = blogsEntry; array[2] = getByC_LtD_NotS_PrevAndNext( session, blogsEntry, companyId, displayDate, status, orderByComparator, false); return array; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } protected BlogsEntry getByC_LtD_NotS_PrevAndNext( Session session, BlogsEntry blogsEntry, long companyId, Date displayDate, int status, OrderByComparator orderByComparator, boolean previous) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 6 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(5); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_C_LTD_NOTS_COMPANYID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_C_LTD_NOTS_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_C_LTD_NOTS_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_C_LTD_NOTS_STATUS_2); if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { query.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByConditionFields[i]); if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN_HAS_NEXT); } else { query.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN); } else { query.append(WHERE_LESSER_THAN); } } } query.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByFields[i]); if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC_HAS_NEXT); } else { query.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC); } else { query.append(ORDER_BY_DESC); } } } } else { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Query q = session.createQuery(sql); q.setFirstResult(0); q.setMaxResults(2); QueryPos qPos = QueryPos.getInstance(q); qPos.add(companyId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues(blogsEntry)) { qPos.add(orderByConditionValue); } } List list = q.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Removes all the blogs entries where companyId = ? and displayDate < ? and status ≠ ? from the database. * * @param companyId the company ID * @param displayDate the display date * @param status the status */ @Override public void removeByC_LtD_NotS( long companyId, Date displayDate, int status) { for (BlogsEntry blogsEntry : findByC_LtD_NotS( companyId, displayDate, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(blogsEntry); } } /** * Returns the number of blogs entries where companyId = ? and displayDate < ? and status ≠ ?. * * @param companyId the company ID * @param displayDate the display date * @param status the status * @return the number of matching blogs entries */ @Override public int countByC_LtD_NotS(long companyId, Date displayDate, int status) { FinderPath finderPath = _finderPathWithPaginationCountByC_LtD_NotS; Object[] finderArgs = new Object[] { companyId, _getTime(displayDate), status }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(4); query.append(_SQL_COUNT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_C_LTD_NOTS_COMPANYID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_C_LTD_NOTS_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_C_LTD_NOTS_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_C_LTD_NOTS_STATUS_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(companyId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); } private static final String _FINDER_COLUMN_C_LTD_NOTS_COMPANYID_2 = "blogsEntry.companyId = ? AND "; private static final String _FINDER_COLUMN_C_LTD_NOTS_DISPLAYDATE_1 = "blogsEntry.displayDate IS NULL AND "; private static final String _FINDER_COLUMN_C_LTD_NOTS_DISPLAYDATE_2 = "blogsEntry.displayDate < ? AND "; private static final String _FINDER_COLUMN_C_LTD_NOTS_STATUS_2 = "blogsEntry.status != ?"; private FinderPath _finderPathWithPaginationFindByG_U_LtD_S; private FinderPath _finderPathWithPaginationCountByG_U_LtD_S; /** * Returns all the blogs entries where groupId = ? and userId = ? and displayDate < ? and status = ?. * * @param groupId the group ID * @param userId the user ID * @param displayDate the display date * @param status the status * @return the matching blogs entries */ @Override public List findByG_U_LtD_S( long groupId, long userId, Date displayDate, int status) { return findByG_U_LtD_S( groupId, userId, displayDate, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the blogs entries where groupId = ? and userId = ? and displayDate < ? 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param userId the user ID * @param displayDate the display date * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @return the range of matching blogs entries */ @Override public List findByG_U_LtD_S( long groupId, long userId, Date displayDate, int status, int start, int end) { return findByG_U_LtD_S( groupId, userId, displayDate, status, start, end, null); } /** * Returns an ordered range of all the blogs entries where groupId = ? and userId = ? and displayDate < ? 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param userId the user ID * @param displayDate the display date * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching blogs entries */ @Override public List findByG_U_LtD_S( long groupId, long userId, Date displayDate, int status, int start, int end, OrderByComparator orderByComparator) { return findByG_U_LtD_S( groupId, userId, displayDate, status, start, end, orderByComparator, true); } /** * Returns an ordered range of all the blogs entries where groupId = ? and userId = ? and displayDate < ? 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param userId the user ID * @param displayDate the display date * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @param retrieveFromCache whether to retrieve from the finder cache * @return the ordered range of matching blogs entries */ @Override public List findByG_U_LtD_S( long groupId, long userId, Date displayDate, int status, int start, int end, OrderByComparator orderByComparator, boolean retrieveFromCache) { boolean pagination = true; FinderPath finderPath = null; Object[] finderArgs = null; finderPath = _finderPathWithPaginationFindByG_U_LtD_S; finderArgs = new Object[] { groupId, userId, _getTime(displayDate), status, start, end, orderByComparator }; List list = null; if (retrieveFromCache) { list = (List)finderCache.getResult( finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (BlogsEntry blogsEntry : list) { if ((groupId != blogsEntry.getGroupId()) || (userId != blogsEntry.getUserId()) || (displayDate.getTime() <= blogsEntry.getDisplayDate().getTime()) || (status != blogsEntry.getStatus())) { list = null; break; } } } } if (list == null) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 6 + (orderByComparator.getOrderByFields().length * 2)); } else { query = new StringBundler(6); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_U_LTD_S_GROUPID_2); query.append(_FINDER_COLUMN_G_U_LTD_S_USERID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_G_U_LTD_S_STATUS_2); if (orderByComparator != null) { appendOrderByComparator( query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(userId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); if (!pagination) { list = (List)QueryUtil.list( q, getDialect(), start, end, false); Collections.sort(list); list = Collections.unmodifiableList(list); } else { list = (List)QueryUtil.list( q, getDialect(), start, end); } cacheResult(list); finderCache.putResult(finderPath, finderArgs, list); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; } /** * Returns the first blogs entry in the ordered set where groupId = ? and userId = ? and displayDate < ? and status = ?. * * @param groupId the group ID * @param userId the user ID * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByG_U_LtD_S_First( long groupId, long userId, Date displayDate, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByG_U_LtD_S_First( groupId, userId, displayDate, status, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(10); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("groupId="); msg.append(groupId); msg.append(", userId="); msg.append(userId); msg.append(", displayDate="); msg.append(displayDate); msg.append(", status="); msg.append(status); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the first blogs entry in the ordered set where groupId = ? and userId = ? and displayDate < ? and status = ?. * * @param groupId the group ID * @param userId the user ID * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry fetchByG_U_LtD_S_First( long groupId, long userId, Date displayDate, int status, OrderByComparator orderByComparator) { List list = findByG_U_LtD_S( groupId, userId, displayDate, status, 0, 1, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the last blogs entry in the ordered set where groupId = ? and userId = ? and displayDate < ? and status = ?. * * @param groupId the group ID * @param userId the user ID * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByG_U_LtD_S_Last( long groupId, long userId, Date displayDate, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByG_U_LtD_S_Last( groupId, userId, displayDate, status, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(10); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("groupId="); msg.append(groupId); msg.append(", userId="); msg.append(userId); msg.append(", displayDate="); msg.append(displayDate); msg.append(", status="); msg.append(status); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the last blogs entry in the ordered set where groupId = ? and userId = ? and displayDate < ? and status = ?. * * @param groupId the group ID * @param userId the user ID * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry fetchByG_U_LtD_S_Last( long groupId, long userId, Date displayDate, int status, OrderByComparator orderByComparator) { int count = countByG_U_LtD_S(groupId, userId, displayDate, status); if (count == 0) { return null; } List list = findByG_U_LtD_S( groupId, userId, displayDate, status, count - 1, count, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the blogs entries before and after the current blogs entry in the ordered set where groupId = ? and userId = ? and displayDate < ? and status = ?. * * @param entryId the primary key of the current blogs entry * @param groupId the group ID * @param userId the user ID * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the previous, current, and next blogs entry * @throws NoSuchEntryException if a blogs entry with the primary key could not be found */ @Override public BlogsEntry[] findByG_U_LtD_S_PrevAndNext( long entryId, long groupId, long userId, Date displayDate, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BlogsEntry[] array = new BlogsEntryImpl[3]; array[0] = getByG_U_LtD_S_PrevAndNext( session, blogsEntry, groupId, userId, displayDate, status, orderByComparator, true); array[1] = blogsEntry; array[2] = getByG_U_LtD_S_PrevAndNext( session, blogsEntry, groupId, userId, displayDate, status, orderByComparator, false); return array; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } protected BlogsEntry getByG_U_LtD_S_PrevAndNext( Session session, BlogsEntry blogsEntry, long groupId, long userId, Date displayDate, int status, OrderByComparator orderByComparator, boolean previous) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 7 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(6); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_U_LTD_S_GROUPID_2); query.append(_FINDER_COLUMN_G_U_LTD_S_USERID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_G_U_LTD_S_STATUS_2); if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { query.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByConditionFields[i]); if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN_HAS_NEXT); } else { query.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN); } else { query.append(WHERE_LESSER_THAN); } } } query.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByFields[i]); if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC_HAS_NEXT); } else { query.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC); } else { query.append(ORDER_BY_DESC); } } } } else { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Query q = session.createQuery(sql); q.setFirstResult(0); q.setMaxResults(2); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(userId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues(blogsEntry)) { qPos.add(orderByConditionValue); } } List list = q.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Returns all the blogs entries that the user has permission to view where groupId = ? and userId = ? and displayDate < ? and status = ?. * * @param groupId the group ID * @param userId the user ID * @param displayDate the display date * @param status the status * @return the matching blogs entries that the user has permission to view */ @Override public List filterFindByG_U_LtD_S( long groupId, long userId, Date displayDate, int status) { return filterFindByG_U_LtD_S( groupId, userId, displayDate, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the blogs entries that the user has permission to view where groupId = ? and userId = ? and displayDate < ? 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param userId the user ID * @param displayDate the display date * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @return the range of matching blogs entries that the user has permission to view */ @Override public List filterFindByG_U_LtD_S( long groupId, long userId, Date displayDate, int status, int start, int end) { return filterFindByG_U_LtD_S( groupId, userId, displayDate, status, start, end, null); } /** * Returns an ordered range of all the blogs entries that the user has permissions to view where groupId = ? and userId = ? and displayDate < ? 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param userId the user ID * @param displayDate the display date * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching blogs entries that the user has permission to view */ @Override public List filterFindByG_U_LtD_S( long groupId, long userId, Date displayDate, int status, int start, int end, OrderByComparator orderByComparator) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByG_U_LtD_S( groupId, userId, displayDate, status, start, end, orderByComparator); } StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 6 + (orderByComparator.getOrderByFields().length * 2)); } else { query = new StringBundler(7); } if (getDB().isSupportsInlineDistinct()) { query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE); } else { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1); } query.append(_FINDER_COLUMN_G_U_LTD_S_GROUPID_2); query.append(_FINDER_COLUMN_G_U_LTD_S_USERID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_G_U_LTD_S_STATUS_2); if (!getDB().isSupportsInlineDistinct()) { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { if (getDB().isSupportsInlineDistinct()) { appendOrderByComparator( query, _ORDER_BY_ENTITY_ALIAS, orderByComparator, true); } else { appendOrderByComparator( query, _ORDER_BY_ENTITY_TABLE, orderByComparator, true); } } else { if (getDB().isSupportsInlineDistinct()) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } else { query.append(BlogsEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck( query.toString(), BlogsEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery q = session.createSynchronizedSQLQuery(sql); if (getDB().isSupportsInlineDistinct()) { q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class); } else { q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class); } QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(userId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); return (List)QueryUtil.list( q, getDialect(), start, end); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } /** * Returns the blogs entries before and after the current blogs entry in the ordered set of blogs entries that the user has permission to view where groupId = ? and userId = ? and displayDate < ? and status = ?. * * @param entryId the primary key of the current blogs entry * @param groupId the group ID * @param userId the user ID * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the previous, current, and next blogs entry * @throws NoSuchEntryException if a blogs entry with the primary key could not be found */ @Override public BlogsEntry[] filterFindByG_U_LtD_S_PrevAndNext( long entryId, long groupId, long userId, Date displayDate, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByG_U_LtD_S_PrevAndNext( entryId, groupId, userId, displayDate, status, orderByComparator); } BlogsEntry blogsEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BlogsEntry[] array = new BlogsEntryImpl[3]; array[0] = filterGetByG_U_LtD_S_PrevAndNext( session, blogsEntry, groupId, userId, displayDate, status, orderByComparator, true); array[1] = blogsEntry; array[2] = filterGetByG_U_LtD_S_PrevAndNext( session, blogsEntry, groupId, userId, displayDate, status, orderByComparator, false); return array; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } protected BlogsEntry filterGetByG_U_LtD_S_PrevAndNext( Session session, BlogsEntry blogsEntry, long groupId, long userId, Date displayDate, int status, OrderByComparator orderByComparator, boolean previous) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 8 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(7); } if (getDB().isSupportsInlineDistinct()) { query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE); } else { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1); } query.append(_FINDER_COLUMN_G_U_LTD_S_GROUPID_2); query.append(_FINDER_COLUMN_G_U_LTD_S_USERID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_G_U_LTD_S_STATUS_2); if (!getDB().isSupportsInlineDistinct()) { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { query.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { if (getDB().isSupportsInlineDistinct()) { query.append( getColumnName( _ORDER_BY_ENTITY_ALIAS, orderByConditionFields[i], true)); } else { query.append( getColumnName( _ORDER_BY_ENTITY_TABLE, orderByConditionFields[i], true)); } if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN_HAS_NEXT); } else { query.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN); } else { query.append(WHERE_LESSER_THAN); } } } query.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { if (getDB().isSupportsInlineDistinct()) { query.append( getColumnName( _ORDER_BY_ENTITY_ALIAS, orderByFields[i], true)); } else { query.append( getColumnName( _ORDER_BY_ENTITY_TABLE, orderByFields[i], true)); } if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC_HAS_NEXT); } else { query.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC); } else { query.append(ORDER_BY_DESC); } } } } else { if (getDB().isSupportsInlineDistinct()) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } else { query.append(BlogsEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck( query.toString(), BlogsEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); SQLQuery q = session.createSynchronizedSQLQuery(sql); q.setFirstResult(0); q.setMaxResults(2); if (getDB().isSupportsInlineDistinct()) { q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class); } else { q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class); } QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(userId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues(blogsEntry)) { qPos.add(orderByConditionValue); } } List list = q.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Removes all the blogs entries where groupId = ? and userId = ? and displayDate < ? and status = ? from the database. * * @param groupId the group ID * @param userId the user ID * @param displayDate the display date * @param status the status */ @Override public void removeByG_U_LtD_S( long groupId, long userId, Date displayDate, int status) { for (BlogsEntry blogsEntry : findByG_U_LtD_S( groupId, userId, displayDate, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(blogsEntry); } } /** * Returns the number of blogs entries where groupId = ? and userId = ? and displayDate < ? and status = ?. * * @param groupId the group ID * @param userId the user ID * @param displayDate the display date * @param status the status * @return the number of matching blogs entries */ @Override public int countByG_U_LtD_S( long groupId, long userId, Date displayDate, int status) { FinderPath finderPath = _finderPathWithPaginationCountByG_U_LtD_S; Object[] finderArgs = new Object[] { groupId, userId, _getTime(displayDate), status }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(5); query.append(_SQL_COUNT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_U_LTD_S_GROUPID_2); query.append(_FINDER_COLUMN_G_U_LTD_S_USERID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_G_U_LTD_S_STATUS_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(userId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); } /** * Returns the number of blogs entries that the user has permission to view where groupId = ? and userId = ? and displayDate < ? and status = ?. * * @param groupId the group ID * @param userId the user ID * @param displayDate the display date * @param status the status * @return the number of matching blogs entries that the user has permission to view */ @Override public int filterCountByG_U_LtD_S( long groupId, long userId, Date displayDate, int status) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return countByG_U_LtD_S(groupId, userId, displayDate, status); } StringBundler query = new StringBundler(5); query.append(_FILTER_SQL_COUNT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_U_LTD_S_GROUPID_2); query.append(_FINDER_COLUMN_G_U_LTD_S_USERID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_G_U_LTD_S_STATUS_2); String sql = InlineSQLHelperUtil.replacePermissionCheck( query.toString(), BlogsEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery q = session.createSynchronizedSQLQuery(sql); q.addScalar( COUNT_COLUMN_NAME, com.liferay.portal.kernel.dao.orm.Type.LONG); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(userId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); Long count = (Long)q.uniqueResult(); return count.intValue(); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } private static final String _FINDER_COLUMN_G_U_LTD_S_GROUPID_2 = "blogsEntry.groupId = ? AND "; private static final String _FINDER_COLUMN_G_U_LTD_S_USERID_2 = "blogsEntry.userId = ? AND "; private static final String _FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_1 = "blogsEntry.displayDate IS NULL AND "; private static final String _FINDER_COLUMN_G_U_LTD_S_DISPLAYDATE_2 = "blogsEntry.displayDate < ? AND "; private static final String _FINDER_COLUMN_G_U_LTD_S_STATUS_2 = "blogsEntry.status = ?"; private FinderPath _finderPathWithPaginationFindByG_U_LtD_NotS; private FinderPath _finderPathWithPaginationCountByG_U_LtD_NotS; /** * Returns all the blogs entries where groupId = ? and userId = ? and displayDate < ? and status ≠ ?. * * @param groupId the group ID * @param userId the user ID * @param displayDate the display date * @param status the status * @return the matching blogs entries */ @Override public List findByG_U_LtD_NotS( long groupId, long userId, Date displayDate, int status) { return findByG_U_LtD_NotS( groupId, userId, displayDate, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the blogs entries where groupId = ? and userId = ? and displayDate < ? 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param userId the user ID * @param displayDate the display date * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @return the range of matching blogs entries */ @Override public List findByG_U_LtD_NotS( long groupId, long userId, Date displayDate, int status, int start, int end) { return findByG_U_LtD_NotS( groupId, userId, displayDate, status, start, end, null); } /** * Returns an ordered range of all the blogs entries where groupId = ? and userId = ? and displayDate < ? 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param userId the user ID * @param displayDate the display date * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching blogs entries */ @Override public List findByG_U_LtD_NotS( long groupId, long userId, Date displayDate, int status, int start, int end, OrderByComparator orderByComparator) { return findByG_U_LtD_NotS( groupId, userId, displayDate, status, start, end, orderByComparator, true); } /** * Returns an ordered range of all the blogs entries where groupId = ? and userId = ? and displayDate < ? 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param userId the user ID * @param displayDate the display date * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @param retrieveFromCache whether to retrieve from the finder cache * @return the ordered range of matching blogs entries */ @Override public List findByG_U_LtD_NotS( long groupId, long userId, Date displayDate, int status, int start, int end, OrderByComparator orderByComparator, boolean retrieveFromCache) { boolean pagination = true; FinderPath finderPath = null; Object[] finderArgs = null; finderPath = _finderPathWithPaginationFindByG_U_LtD_NotS; finderArgs = new Object[] { groupId, userId, _getTime(displayDate), status, start, end, orderByComparator }; List list = null; if (retrieveFromCache) { list = (List)finderCache.getResult( finderPath, finderArgs, this); if ((list != null) && !list.isEmpty()) { for (BlogsEntry blogsEntry : list) { if ((groupId != blogsEntry.getGroupId()) || (userId != blogsEntry.getUserId()) || (displayDate.getTime() <= blogsEntry.getDisplayDate().getTime()) || (status == blogsEntry.getStatus())) { list = null; break; } } } } if (list == null) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 6 + (orderByComparator.getOrderByFields().length * 2)); } else { query = new StringBundler(6); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_U_LTD_NOTS_GROUPID_2); query.append(_FINDER_COLUMN_G_U_LTD_NOTS_USERID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_U_LTD_NOTS_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_U_LTD_NOTS_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_G_U_LTD_NOTS_STATUS_2); if (orderByComparator != null) { appendOrderByComparator( query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); } else if (pagination) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(userId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); if (!pagination) { list = (List)QueryUtil.list( q, getDialect(), start, end, false); Collections.sort(list); list = Collections.unmodifiableList(list); } else { list = (List)QueryUtil.list( q, getDialect(), start, end); } cacheResult(list); finderCache.putResult(finderPath, finderArgs, list); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; } /** * Returns the first blogs entry in the ordered set where groupId = ? and userId = ? and displayDate < ? and status ≠ ?. * * @param groupId the group ID * @param userId the user ID * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByG_U_LtD_NotS_First( long groupId, long userId, Date displayDate, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByG_U_LtD_NotS_First( groupId, userId, displayDate, status, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(10); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("groupId="); msg.append(groupId); msg.append(", userId="); msg.append(userId); msg.append(", displayDate="); msg.append(displayDate); msg.append(", status="); msg.append(status); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the first blogs entry in the ordered set where groupId = ? and userId = ? and displayDate < ? and status ≠ ?. * * @param groupId the group ID * @param userId the user ID * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the first matching blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry fetchByG_U_LtD_NotS_First( long groupId, long userId, Date displayDate, int status, OrderByComparator orderByComparator) { List list = findByG_U_LtD_NotS( groupId, userId, displayDate, status, 0, 1, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the last blogs entry in the ordered set where groupId = ? and userId = ? and displayDate < ? and status ≠ ?. * * @param groupId the group ID * @param userId the user ID * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching blogs entry * @throws NoSuchEntryException if a matching blogs entry could not be found */ @Override public BlogsEntry findByG_U_LtD_NotS_Last( long groupId, long userId, Date displayDate, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByG_U_LtD_NotS_Last( groupId, userId, displayDate, status, orderByComparator); if (blogsEntry != null) { return blogsEntry; } StringBundler msg = new StringBundler(10); msg.append(_NO_SUCH_ENTITY_WITH_KEY); msg.append("groupId="); msg.append(groupId); msg.append(", userId="); msg.append(userId); msg.append(", displayDate="); msg.append(displayDate); msg.append(", status="); msg.append(status); msg.append("}"); throw new NoSuchEntryException(msg.toString()); } /** * Returns the last blogs entry in the ordered set where groupId = ? and userId = ? and displayDate < ? and status ≠ ?. * * @param groupId the group ID * @param userId the user ID * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the last matching blogs entry, or null if a matching blogs entry could not be found */ @Override public BlogsEntry fetchByG_U_LtD_NotS_Last( long groupId, long userId, Date displayDate, int status, OrderByComparator orderByComparator) { int count = countByG_U_LtD_NotS(groupId, userId, displayDate, status); if (count == 0) { return null; } List list = findByG_U_LtD_NotS( groupId, userId, displayDate, status, count - 1, count, orderByComparator); if (!list.isEmpty()) { return list.get(0); } return null; } /** * Returns the blogs entries before and after the current blogs entry in the ordered set where groupId = ? and userId = ? and displayDate < ? and status ≠ ?. * * @param entryId the primary key of the current blogs entry * @param groupId the group ID * @param userId the user ID * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the previous, current, and next blogs entry * @throws NoSuchEntryException if a blogs entry with the primary key could not be found */ @Override public BlogsEntry[] findByG_U_LtD_NotS_PrevAndNext( long entryId, long groupId, long userId, Date displayDate, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { BlogsEntry blogsEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BlogsEntry[] array = new BlogsEntryImpl[3]; array[0] = getByG_U_LtD_NotS_PrevAndNext( session, blogsEntry, groupId, userId, displayDate, status, orderByComparator, true); array[1] = blogsEntry; array[2] = getByG_U_LtD_NotS_PrevAndNext( session, blogsEntry, groupId, userId, displayDate, status, orderByComparator, false); return array; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } protected BlogsEntry getByG_U_LtD_NotS_PrevAndNext( Session session, BlogsEntry blogsEntry, long groupId, long userId, Date displayDate, int status, OrderByComparator orderByComparator, boolean previous) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 7 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(6); } query.append(_SQL_SELECT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_U_LTD_NOTS_GROUPID_2); query.append(_FINDER_COLUMN_G_U_LTD_NOTS_USERID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_U_LTD_NOTS_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_U_LTD_NOTS_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_G_U_LTD_NOTS_STATUS_2); if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { query.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByConditionFields[i]); if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN_HAS_NEXT); } else { query.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN); } else { query.append(WHERE_LESSER_THAN); } } } query.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { query.append(_ORDER_BY_ENTITY_ALIAS); query.append(orderByFields[i]); if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC_HAS_NEXT); } else { query.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC); } else { query.append(ORDER_BY_DESC); } } } } else { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } String sql = query.toString(); Query q = session.createQuery(sql); q.setFirstResult(0); q.setMaxResults(2); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(userId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues(blogsEntry)) { qPos.add(orderByConditionValue); } } List list = q.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Returns all the blogs entries that the user has permission to view where groupId = ? and userId = ? and displayDate < ? and status ≠ ?. * * @param groupId the group ID * @param userId the user ID * @param displayDate the display date * @param status the status * @return the matching blogs entries that the user has permission to view */ @Override public List filterFindByG_U_LtD_NotS( long groupId, long userId, Date displayDate, int status) { return filterFindByG_U_LtD_NotS( groupId, userId, displayDate, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the blogs entries that the user has permission to view where groupId = ? and userId = ? and displayDate < ? 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param userId the user ID * @param displayDate the display date * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @return the range of matching blogs entries that the user has permission to view */ @Override public List filterFindByG_U_LtD_NotS( long groupId, long userId, Date displayDate, int status, int start, int end) { return filterFindByG_U_LtD_NotS( groupId, userId, displayDate, status, start, end, null); } /** * Returns an ordered range of all the blogs entries that the user has permissions to view where groupId = ? and userId = ? and displayDate < ? 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param groupId the group ID * @param userId the user ID * @param displayDate the display date * @param status the status * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of matching blogs entries that the user has permission to view */ @Override public List filterFindByG_U_LtD_NotS( long groupId, long userId, Date displayDate, int status, int start, int end, OrderByComparator orderByComparator) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByG_U_LtD_NotS( groupId, userId, displayDate, status, start, end, orderByComparator); } StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 6 + (orderByComparator.getOrderByFields().length * 2)); } else { query = new StringBundler(7); } if (getDB().isSupportsInlineDistinct()) { query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE); } else { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1); } query.append(_FINDER_COLUMN_G_U_LTD_NOTS_GROUPID_2); query.append(_FINDER_COLUMN_G_U_LTD_NOTS_USERID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_U_LTD_NOTS_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_U_LTD_NOTS_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_G_U_LTD_NOTS_STATUS_2); if (!getDB().isSupportsInlineDistinct()) { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { if (getDB().isSupportsInlineDistinct()) { appendOrderByComparator( query, _ORDER_BY_ENTITY_ALIAS, orderByComparator, true); } else { appendOrderByComparator( query, _ORDER_BY_ENTITY_TABLE, orderByComparator, true); } } else { if (getDB().isSupportsInlineDistinct()) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } else { query.append(BlogsEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck( query.toString(), BlogsEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery q = session.createSynchronizedSQLQuery(sql); if (getDB().isSupportsInlineDistinct()) { q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class); } else { q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class); } QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(userId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); return (List)QueryUtil.list( q, getDialect(), start, end); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } /** * Returns the blogs entries before and after the current blogs entry in the ordered set of blogs entries that the user has permission to view where groupId = ? and userId = ? and displayDate < ? and status ≠ ?. * * @param entryId the primary key of the current blogs entry * @param groupId the group ID * @param userId the user ID * @param displayDate the display date * @param status the status * @param orderByComparator the comparator to order the set by (optionally null) * @return the previous, current, and next blogs entry * @throws NoSuchEntryException if a blogs entry with the primary key could not be found */ @Override public BlogsEntry[] filterFindByG_U_LtD_NotS_PrevAndNext( long entryId, long groupId, long userId, Date displayDate, int status, OrderByComparator orderByComparator) throws NoSuchEntryException { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return findByG_U_LtD_NotS_PrevAndNext( entryId, groupId, userId, displayDate, status, orderByComparator); } BlogsEntry blogsEntry = findByPrimaryKey(entryId); Session session = null; try { session = openSession(); BlogsEntry[] array = new BlogsEntryImpl[3]; array[0] = filterGetByG_U_LtD_NotS_PrevAndNext( session, blogsEntry, groupId, userId, displayDate, status, orderByComparator, true); array[1] = blogsEntry; array[2] = filterGetByG_U_LtD_NotS_PrevAndNext( session, blogsEntry, groupId, userId, displayDate, status, orderByComparator, false); return array; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } protected BlogsEntry filterGetByG_U_LtD_NotS_PrevAndNext( Session session, BlogsEntry blogsEntry, long groupId, long userId, Date displayDate, int status, OrderByComparator orderByComparator, boolean previous) { StringBundler query = null; if (orderByComparator != null) { query = new StringBundler( 8 + (orderByComparator.getOrderByConditionFields().length * 3) + (orderByComparator.getOrderByFields().length * 3)); } else { query = new StringBundler(7); } if (getDB().isSupportsInlineDistinct()) { query.append(_FILTER_SQL_SELECT_BLOGSENTRY_WHERE); } else { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1); } query.append(_FINDER_COLUMN_G_U_LTD_NOTS_GROUPID_2); query.append(_FINDER_COLUMN_G_U_LTD_NOTS_USERID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_U_LTD_NOTS_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_U_LTD_NOTS_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_G_U_LTD_NOTS_STATUS_2); if (!getDB().isSupportsInlineDistinct()) { query.append( _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2); } if (orderByComparator != null) { String[] orderByConditionFields = orderByComparator.getOrderByConditionFields(); if (orderByConditionFields.length > 0) { query.append(WHERE_AND); } for (int i = 0; i < orderByConditionFields.length; i++) { if (getDB().isSupportsInlineDistinct()) { query.append( getColumnName( _ORDER_BY_ENTITY_ALIAS, orderByConditionFields[i], true)); } else { query.append( getColumnName( _ORDER_BY_ENTITY_TABLE, orderByConditionFields[i], true)); } if ((i + 1) < orderByConditionFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN_HAS_NEXT); } else { query.append(WHERE_LESSER_THAN_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(WHERE_GREATER_THAN); } else { query.append(WHERE_LESSER_THAN); } } } query.append(ORDER_BY_CLAUSE); String[] orderByFields = orderByComparator.getOrderByFields(); for (int i = 0; i < orderByFields.length; i++) { if (getDB().isSupportsInlineDistinct()) { query.append( getColumnName( _ORDER_BY_ENTITY_ALIAS, orderByFields[i], true)); } else { query.append( getColumnName( _ORDER_BY_ENTITY_TABLE, orderByFields[i], true)); } if ((i + 1) < orderByFields.length) { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC_HAS_NEXT); } else { query.append(ORDER_BY_DESC_HAS_NEXT); } } else { if (orderByComparator.isAscending() ^ previous) { query.append(ORDER_BY_ASC); } else { query.append(ORDER_BY_DESC); } } } } else { if (getDB().isSupportsInlineDistinct()) { query.append(BlogsEntryModelImpl.ORDER_BY_JPQL); } else { query.append(BlogsEntryModelImpl.ORDER_BY_SQL); } } String sql = InlineSQLHelperUtil.replacePermissionCheck( query.toString(), BlogsEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); SQLQuery q = session.createSynchronizedSQLQuery(sql); q.setFirstResult(0); q.setMaxResults(2); if (getDB().isSupportsInlineDistinct()) { q.addEntity(_FILTER_ENTITY_ALIAS, BlogsEntryImpl.class); } else { q.addEntity(_FILTER_ENTITY_TABLE, BlogsEntryImpl.class); } QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(userId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); if (orderByComparator != null) { for (Object orderByConditionValue : orderByComparator.getOrderByConditionValues(blogsEntry)) { qPos.add(orderByConditionValue); } } List list = q.list(); if (list.size() == 2) { return list.get(1); } else { return null; } } /** * Removes all the blogs entries where groupId = ? and userId = ? and displayDate < ? and status ≠ ? from the database. * * @param groupId the group ID * @param userId the user ID * @param displayDate the display date * @param status the status */ @Override public void removeByG_U_LtD_NotS( long groupId, long userId, Date displayDate, int status) { for (BlogsEntry blogsEntry : findByG_U_LtD_NotS( groupId, userId, displayDate, status, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) { remove(blogsEntry); } } /** * Returns the number of blogs entries where groupId = ? and userId = ? and displayDate < ? and status ≠ ?. * * @param groupId the group ID * @param userId the user ID * @param displayDate the display date * @param status the status * @return the number of matching blogs entries */ @Override public int countByG_U_LtD_NotS( long groupId, long userId, Date displayDate, int status) { FinderPath finderPath = _finderPathWithPaginationCountByG_U_LtD_NotS; Object[] finderArgs = new Object[] { groupId, userId, _getTime(displayDate), status }; Long count = (Long)finderCache.getResult(finderPath, finderArgs, this); if (count == null) { StringBundler query = new StringBundler(5); query.append(_SQL_COUNT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_U_LTD_NOTS_GROUPID_2); query.append(_FINDER_COLUMN_G_U_LTD_NOTS_USERID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_U_LTD_NOTS_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_U_LTD_NOTS_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_G_U_LTD_NOTS_STATUS_2); String sql = query.toString(); Session session = null; try { session = openSession(); Query q = session.createQuery(sql); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(userId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); count = (Long)q.uniqueResult(); finderCache.putResult(finderPath, finderArgs, count); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return count.intValue(); } /** * Returns the number of blogs entries that the user has permission to view where groupId = ? and userId = ? and displayDate < ? and status ≠ ?. * * @param groupId the group ID * @param userId the user ID * @param displayDate the display date * @param status the status * @return the number of matching blogs entries that the user has permission to view */ @Override public int filterCountByG_U_LtD_NotS( long groupId, long userId, Date displayDate, int status) { if (!InlineSQLHelperUtil.isEnabled(groupId)) { return countByG_U_LtD_NotS(groupId, userId, displayDate, status); } StringBundler query = new StringBundler(5); query.append(_FILTER_SQL_COUNT_BLOGSENTRY_WHERE); query.append(_FINDER_COLUMN_G_U_LTD_NOTS_GROUPID_2); query.append(_FINDER_COLUMN_G_U_LTD_NOTS_USERID_2); boolean bindDisplayDate = false; if (displayDate == null) { query.append(_FINDER_COLUMN_G_U_LTD_NOTS_DISPLAYDATE_1); } else { bindDisplayDate = true; query.append(_FINDER_COLUMN_G_U_LTD_NOTS_DISPLAYDATE_2); } query.append(_FINDER_COLUMN_G_U_LTD_NOTS_STATUS_2); String sql = InlineSQLHelperUtil.replacePermissionCheck( query.toString(), BlogsEntry.class.getName(), _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN, groupId); Session session = null; try { session = openSession(); SQLQuery q = session.createSynchronizedSQLQuery(sql); q.addScalar( COUNT_COLUMN_NAME, com.liferay.portal.kernel.dao.orm.Type.LONG); QueryPos qPos = QueryPos.getInstance(q); qPos.add(groupId); qPos.add(userId); if (bindDisplayDate) { qPos.add(new Timestamp(displayDate.getTime())); } qPos.add(status); Long count = (Long)q.uniqueResult(); return count.intValue(); } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } private static final String _FINDER_COLUMN_G_U_LTD_NOTS_GROUPID_2 = "blogsEntry.groupId = ? AND "; private static final String _FINDER_COLUMN_G_U_LTD_NOTS_USERID_2 = "blogsEntry.userId = ? AND "; private static final String _FINDER_COLUMN_G_U_LTD_NOTS_DISPLAYDATE_1 = "blogsEntry.displayDate IS NULL AND "; private static final String _FINDER_COLUMN_G_U_LTD_NOTS_DISPLAYDATE_2 = "blogsEntry.displayDate < ? AND "; private static final String _FINDER_COLUMN_G_U_LTD_NOTS_STATUS_2 = "blogsEntry.status != ?"; public BlogsEntryPersistenceImpl() { setModelClass(BlogsEntry.class); setModelImplClass(BlogsEntryImpl.class); setModelPKClass(long.class); Map dbColumnNames = new HashMap(); dbColumnNames.put("uuid", "uuid_"); setDBColumnNames(dbColumnNames); } /** * Caches the blogs entry in the entity cache if it is enabled. * * @param blogsEntry the blogs entry */ @Override public void cacheResult(BlogsEntry blogsEntry) { entityCache.putResult( entityCacheEnabled, BlogsEntryImpl.class, blogsEntry.getPrimaryKey(), blogsEntry); finderCache.putResult( _finderPathFetchByUUID_G, new Object[] {blogsEntry.getUuid(), blogsEntry.getGroupId()}, blogsEntry); finderCache.putResult( _finderPathFetchByG_UT, new Object[] {blogsEntry.getGroupId(), blogsEntry.getUrlTitle()}, blogsEntry); blogsEntry.resetOriginalValues(); } /** * Caches the blogs entries in the entity cache if it is enabled. * * @param blogsEntries the blogs entries */ @Override public void cacheResult(List blogsEntries) { for (BlogsEntry blogsEntry : blogsEntries) { if (entityCache.getResult( entityCacheEnabled, BlogsEntryImpl.class, blogsEntry.getPrimaryKey()) == null) { cacheResult(blogsEntry); } else { blogsEntry.resetOriginalValues(); } } } /** * Clears the cache for all blogs entries. * *

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

*/ @Override public void clearCache() { entityCache.clearCache(BlogsEntryImpl.class); finderCache.clearCache(FINDER_CLASS_NAME_ENTITY); finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION); finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION); } /** * Clears the cache for the blogs entry. * *

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

*/ @Override public void clearCache(BlogsEntry blogsEntry) { entityCache.removeResult( entityCacheEnabled, BlogsEntryImpl.class, blogsEntry.getPrimaryKey()); finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION); finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION); clearUniqueFindersCache((BlogsEntryModelImpl)blogsEntry, true); } @Override public void clearCache(List blogsEntries) { finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION); finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION); for (BlogsEntry blogsEntry : blogsEntries) { entityCache.removeResult( entityCacheEnabled, BlogsEntryImpl.class, blogsEntry.getPrimaryKey()); clearUniqueFindersCache((BlogsEntryModelImpl)blogsEntry, true); } } protected void cacheUniqueFindersCache( BlogsEntryModelImpl blogsEntryModelImpl) { Object[] args = new Object[] { blogsEntryModelImpl.getUuid(), blogsEntryModelImpl.getGroupId() }; finderCache.putResult( _finderPathCountByUUID_G, args, Long.valueOf(1), false); finderCache.putResult( _finderPathFetchByUUID_G, args, blogsEntryModelImpl, false); args = new Object[] { blogsEntryModelImpl.getGroupId(), blogsEntryModelImpl.getUrlTitle() }; finderCache.putResult( _finderPathCountByG_UT, args, Long.valueOf(1), false); finderCache.putResult( _finderPathFetchByG_UT, args, blogsEntryModelImpl, false); } protected void clearUniqueFindersCache( BlogsEntryModelImpl blogsEntryModelImpl, boolean clearCurrent) { if (clearCurrent) { Object[] args = new Object[] { blogsEntryModelImpl.getUuid(), blogsEntryModelImpl.getGroupId() }; finderCache.removeResult(_finderPathCountByUUID_G, args); finderCache.removeResult(_finderPathFetchByUUID_G, args); } if ((blogsEntryModelImpl.getColumnBitmask() & _finderPathFetchByUUID_G.getColumnBitmask()) != 0) { Object[] args = new Object[] { blogsEntryModelImpl.getOriginalUuid(), blogsEntryModelImpl.getOriginalGroupId() }; finderCache.removeResult(_finderPathCountByUUID_G, args); finderCache.removeResult(_finderPathFetchByUUID_G, args); } if (clearCurrent) { Object[] args = new Object[] { blogsEntryModelImpl.getGroupId(), blogsEntryModelImpl.getUrlTitle() }; finderCache.removeResult(_finderPathCountByG_UT, args); finderCache.removeResult(_finderPathFetchByG_UT, args); } if ((blogsEntryModelImpl.getColumnBitmask() & _finderPathFetchByG_UT.getColumnBitmask()) != 0) { Object[] args = new Object[] { blogsEntryModelImpl.getOriginalGroupId(), blogsEntryModelImpl.getOriginalUrlTitle() }; finderCache.removeResult(_finderPathCountByG_UT, args); finderCache.removeResult(_finderPathFetchByG_UT, args); } } /** * Creates a new blogs entry with the primary key. Does not add the blogs entry to the database. * * @param entryId the primary key for the new blogs entry * @return the new blogs entry */ @Override public BlogsEntry create(long entryId) { BlogsEntry blogsEntry = new BlogsEntryImpl(); blogsEntry.setNew(true); blogsEntry.setPrimaryKey(entryId); String uuid = PortalUUIDUtil.generate(); blogsEntry.setUuid(uuid); blogsEntry.setCompanyId(CompanyThreadLocal.getCompanyId()); return blogsEntry; } /** * Removes the blogs entry with the primary key from the database. Also notifies the appropriate model listeners. * * @param entryId the primary key of the blogs entry * @return the blogs entry that was removed * @throws NoSuchEntryException if a blogs entry with the primary key could not be found */ @Override public BlogsEntry remove(long entryId) throws NoSuchEntryException { return remove((Serializable)entryId); } /** * Removes the blogs entry with the primary key from the database. Also notifies the appropriate model listeners. * * @param primaryKey the primary key of the blogs entry * @return the blogs entry that was removed * @throws NoSuchEntryException if a blogs entry with the primary key could not be found */ @Override public BlogsEntry remove(Serializable primaryKey) throws NoSuchEntryException { Session session = null; try { session = openSession(); BlogsEntry blogsEntry = (BlogsEntry)session.get( BlogsEntryImpl.class, primaryKey); if (blogsEntry == 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(blogsEntry); } catch (NoSuchEntryException nsee) { throw nsee; } catch (Exception e) { throw processException(e); } finally { closeSession(session); } } @Override protected BlogsEntry removeImpl(BlogsEntry blogsEntry) { Session session = null; try { session = openSession(); if (!session.contains(blogsEntry)) { blogsEntry = (BlogsEntry)session.get( BlogsEntryImpl.class, blogsEntry.getPrimaryKeyObj()); } if (blogsEntry != null) { session.delete(blogsEntry); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } if (blogsEntry != null) { clearCache(blogsEntry); } return blogsEntry; } @Override public BlogsEntry updateImpl(BlogsEntry blogsEntry) { boolean isNew = blogsEntry.isNew(); if (!(blogsEntry instanceof BlogsEntryModelImpl)) { InvocationHandler invocationHandler = null; if (ProxyUtil.isProxyClass(blogsEntry.getClass())) { invocationHandler = ProxyUtil.getInvocationHandler(blogsEntry); throw new IllegalArgumentException( "Implement ModelWrapper in blogsEntry proxy " + invocationHandler.getClass()); } throw new IllegalArgumentException( "Implement ModelWrapper in custom BlogsEntry implementation " + blogsEntry.getClass()); } BlogsEntryModelImpl blogsEntryModelImpl = (BlogsEntryModelImpl)blogsEntry; if (Validator.isNull(blogsEntry.getUuid())) { String uuid = PortalUUIDUtil.generate(); blogsEntry.setUuid(uuid); } ServiceContext serviceContext = ServiceContextThreadLocal.getServiceContext(); Date now = new Date(); if (isNew && (blogsEntry.getCreateDate() == null)) { if (serviceContext == null) { blogsEntry.setCreateDate(now); } else { blogsEntry.setCreateDate(serviceContext.getCreateDate(now)); } } if (!blogsEntryModelImpl.hasSetModifiedDate()) { if (serviceContext == null) { blogsEntry.setModifiedDate(now); } else { blogsEntry.setModifiedDate(serviceContext.getModifiedDate(now)); } } long userId = GetterUtil.getLong(PrincipalThreadLocal.getName()); if (userId > 0) { long companyId = blogsEntry.getCompanyId(); long groupId = blogsEntry.getGroupId(); long entryId = 0; if (!isNew) { entryId = blogsEntry.getPrimaryKey(); } try { blogsEntry.setTitle( SanitizerUtil.sanitize( companyId, groupId, userId, BlogsEntry.class.getName(), entryId, ContentTypes.TEXT_PLAIN, Sanitizer.MODE_ALL, blogsEntry.getTitle(), null)); blogsEntry.setContent( SanitizerUtil.sanitize( companyId, groupId, userId, BlogsEntry.class.getName(), entryId, ContentTypes.TEXT_HTML, Sanitizer.MODE_ALL, blogsEntry.getContent(), null)); blogsEntry.setCoverImageCaption( SanitizerUtil.sanitize( companyId, groupId, userId, BlogsEntry.class.getName(), entryId, ContentTypes.TEXT_HTML, Sanitizer.MODE_ALL, blogsEntry.getCoverImageCaption(), null)); } catch (SanitizerException se) { throw new SystemException(se); } } Session session = null; try { session = openSession(); if (blogsEntry.isNew()) { session.save(blogsEntry); blogsEntry.setNew(false); } else { blogsEntry = (BlogsEntry)session.merge(blogsEntry); } } catch (Exception e) { throw processException(e); } finally { closeSession(session); } finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION); if (!_columnBitmaskEnabled) { finderCache.clearCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION); } else if (isNew) { Object[] args = new Object[] {blogsEntryModelImpl.getUuid()}; finderCache.removeResult(_finderPathCountByUuid, args); finderCache.removeResult( _finderPathWithoutPaginationFindByUuid, args); args = new Object[] { blogsEntryModelImpl.getUuid(), blogsEntryModelImpl.getCompanyId() }; finderCache.removeResult(_finderPathCountByUuid_C, args); finderCache.removeResult( _finderPathWithoutPaginationFindByUuid_C, args); args = new Object[] {blogsEntryModelImpl.getGroupId()}; finderCache.removeResult(_finderPathCountByGroupId, args); finderCache.removeResult( _finderPathWithoutPaginationFindByGroupId, args); args = new Object[] {blogsEntryModelImpl.getCompanyId()}; finderCache.removeResult(_finderPathCountByCompanyId, args); finderCache.removeResult( _finderPathWithoutPaginationFindByCompanyId, args); args = new Object[] { blogsEntryModelImpl.getGroupId(), blogsEntryModelImpl.getStatus() }; finderCache.removeResult(_finderPathCountByG_S, args); finderCache.removeResult( _finderPathWithoutPaginationFindByG_S, args); args = new Object[] { blogsEntryModelImpl.getCompanyId(), blogsEntryModelImpl.getUserId() }; finderCache.removeResult(_finderPathCountByC_U, args); finderCache.removeResult( _finderPathWithoutPaginationFindByC_U, args); args = new Object[] { blogsEntryModelImpl.getCompanyId(), blogsEntryModelImpl.getStatus() }; finderCache.removeResult(_finderPathCountByC_S, args); finderCache.removeResult( _finderPathWithoutPaginationFindByC_S, args); args = new Object[] { blogsEntryModelImpl.getGroupId(), blogsEntryModelImpl.getUserId(), blogsEntryModelImpl.getStatus() }; finderCache.removeResult(_finderPathCountByG_U_S, args); finderCache.removeResult( _finderPathWithoutPaginationFindByG_U_S, args); args = new Object[] { blogsEntryModelImpl.getGroupId(), blogsEntryModelImpl.getDisplayDate(), blogsEntryModelImpl.getStatus() }; finderCache.removeResult(_finderPathCountByG_D_S, args); finderCache.removeResult( _finderPathWithoutPaginationFindByG_D_S, args); args = new Object[] { blogsEntryModelImpl.getCompanyId(), blogsEntryModelImpl.getUserId(), blogsEntryModelImpl.getStatus() }; finderCache.removeResult(_finderPathCountByC_U_S, args); finderCache.removeResult( _finderPathWithoutPaginationFindByC_U_S, args); finderCache.removeResult(_finderPathCountAll, FINDER_ARGS_EMPTY); finderCache.removeResult( _finderPathWithoutPaginationFindAll, FINDER_ARGS_EMPTY); } else { if ((blogsEntryModelImpl.getColumnBitmask() & _finderPathWithoutPaginationFindByUuid.getColumnBitmask()) != 0) { Object[] args = new Object[] { blogsEntryModelImpl.getOriginalUuid() }; finderCache.removeResult(_finderPathCountByUuid, args); finderCache.removeResult( _finderPathWithoutPaginationFindByUuid, args); args = new Object[] {blogsEntryModelImpl.getUuid()}; finderCache.removeResult(_finderPathCountByUuid, args); finderCache.removeResult( _finderPathWithoutPaginationFindByUuid, args); } if ((blogsEntryModelImpl.getColumnBitmask() & _finderPathWithoutPaginationFindByUuid_C.getColumnBitmask()) != 0) { Object[] args = new Object[] { blogsEntryModelImpl.getOriginalUuid(), blogsEntryModelImpl.getOriginalCompanyId() }; finderCache.removeResult(_finderPathCountByUuid_C, args); finderCache.removeResult( _finderPathWithoutPaginationFindByUuid_C, args); args = new Object[] { blogsEntryModelImpl.getUuid(), blogsEntryModelImpl.getCompanyId() }; finderCache.removeResult(_finderPathCountByUuid_C, args); finderCache.removeResult( _finderPathWithoutPaginationFindByUuid_C, args); } if ((blogsEntryModelImpl.getColumnBitmask() & _finderPathWithoutPaginationFindByGroupId. getColumnBitmask()) != 0) { Object[] args = new Object[] { blogsEntryModelImpl.getOriginalGroupId() }; finderCache.removeResult(_finderPathCountByGroupId, args); finderCache.removeResult( _finderPathWithoutPaginationFindByGroupId, args); args = new Object[] {blogsEntryModelImpl.getGroupId()}; finderCache.removeResult(_finderPathCountByGroupId, args); finderCache.removeResult( _finderPathWithoutPaginationFindByGroupId, args); } if ((blogsEntryModelImpl.getColumnBitmask() & _finderPathWithoutPaginationFindByCompanyId. getColumnBitmask()) != 0) { Object[] args = new Object[] { blogsEntryModelImpl.getOriginalCompanyId() }; finderCache.removeResult(_finderPathCountByCompanyId, args); finderCache.removeResult( _finderPathWithoutPaginationFindByCompanyId, args); args = new Object[] {blogsEntryModelImpl.getCompanyId()}; finderCache.removeResult(_finderPathCountByCompanyId, args); finderCache.removeResult( _finderPathWithoutPaginationFindByCompanyId, args); } if ((blogsEntryModelImpl.getColumnBitmask() & _finderPathWithoutPaginationFindByG_S.getColumnBitmask()) != 0) { Object[] args = new Object[] { blogsEntryModelImpl.getOriginalGroupId(), blogsEntryModelImpl.getOriginalStatus() }; finderCache.removeResult(_finderPathCountByG_S, args); finderCache.removeResult( _finderPathWithoutPaginationFindByG_S, args); args = new Object[] { blogsEntryModelImpl.getGroupId(), blogsEntryModelImpl.getStatus() }; finderCache.removeResult(_finderPathCountByG_S, args); finderCache.removeResult( _finderPathWithoutPaginationFindByG_S, args); } if ((blogsEntryModelImpl.getColumnBitmask() & _finderPathWithoutPaginationFindByC_U.getColumnBitmask()) != 0) { Object[] args = new Object[] { blogsEntryModelImpl.getOriginalCompanyId(), blogsEntryModelImpl.getOriginalUserId() }; finderCache.removeResult(_finderPathCountByC_U, args); finderCache.removeResult( _finderPathWithoutPaginationFindByC_U, args); args = new Object[] { blogsEntryModelImpl.getCompanyId(), blogsEntryModelImpl.getUserId() }; finderCache.removeResult(_finderPathCountByC_U, args); finderCache.removeResult( _finderPathWithoutPaginationFindByC_U, args); } if ((blogsEntryModelImpl.getColumnBitmask() & _finderPathWithoutPaginationFindByC_S.getColumnBitmask()) != 0) { Object[] args = new Object[] { blogsEntryModelImpl.getOriginalCompanyId(), blogsEntryModelImpl.getOriginalStatus() }; finderCache.removeResult(_finderPathCountByC_S, args); finderCache.removeResult( _finderPathWithoutPaginationFindByC_S, args); args = new Object[] { blogsEntryModelImpl.getCompanyId(), blogsEntryModelImpl.getStatus() }; finderCache.removeResult(_finderPathCountByC_S, args); finderCache.removeResult( _finderPathWithoutPaginationFindByC_S, args); } if ((blogsEntryModelImpl.getColumnBitmask() & _finderPathWithoutPaginationFindByG_U_S.getColumnBitmask()) != 0) { Object[] args = new Object[] { blogsEntryModelImpl.getOriginalGroupId(), blogsEntryModelImpl.getOriginalUserId(), blogsEntryModelImpl.getOriginalStatus() }; finderCache.removeResult(_finderPathCountByG_U_S, args); finderCache.removeResult( _finderPathWithoutPaginationFindByG_U_S, args); args = new Object[] { blogsEntryModelImpl.getGroupId(), blogsEntryModelImpl.getUserId(), blogsEntryModelImpl.getStatus() }; finderCache.removeResult(_finderPathCountByG_U_S, args); finderCache.removeResult( _finderPathWithoutPaginationFindByG_U_S, args); } if ((blogsEntryModelImpl.getColumnBitmask() & _finderPathWithoutPaginationFindByG_D_S.getColumnBitmask()) != 0) { Object[] args = new Object[] { blogsEntryModelImpl.getOriginalGroupId(), blogsEntryModelImpl.getOriginalDisplayDate(), blogsEntryModelImpl.getOriginalStatus() }; finderCache.removeResult(_finderPathCountByG_D_S, args); finderCache.removeResult( _finderPathWithoutPaginationFindByG_D_S, args); args = new Object[] { blogsEntryModelImpl.getGroupId(), blogsEntryModelImpl.getDisplayDate(), blogsEntryModelImpl.getStatus() }; finderCache.removeResult(_finderPathCountByG_D_S, args); finderCache.removeResult( _finderPathWithoutPaginationFindByG_D_S, args); } if ((blogsEntryModelImpl.getColumnBitmask() & _finderPathWithoutPaginationFindByC_U_S.getColumnBitmask()) != 0) { Object[] args = new Object[] { blogsEntryModelImpl.getOriginalCompanyId(), blogsEntryModelImpl.getOriginalUserId(), blogsEntryModelImpl.getOriginalStatus() }; finderCache.removeResult(_finderPathCountByC_U_S, args); finderCache.removeResult( _finderPathWithoutPaginationFindByC_U_S, args); args = new Object[] { blogsEntryModelImpl.getCompanyId(), blogsEntryModelImpl.getUserId(), blogsEntryModelImpl.getStatus() }; finderCache.removeResult(_finderPathCountByC_U_S, args); finderCache.removeResult( _finderPathWithoutPaginationFindByC_U_S, args); } } entityCache.putResult( entityCacheEnabled, BlogsEntryImpl.class, blogsEntry.getPrimaryKey(), blogsEntry, false); clearUniqueFindersCache(blogsEntryModelImpl, false); cacheUniqueFindersCache(blogsEntryModelImpl); blogsEntry.resetOriginalValues(); return blogsEntry; } /** * Returns the blogs 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 blogs entry * @return the blogs entry * @throws NoSuchEntryException if a blogs entry with the primary key could not be found */ @Override public BlogsEntry findByPrimaryKey(Serializable primaryKey) throws NoSuchEntryException { BlogsEntry blogsEntry = fetchByPrimaryKey(primaryKey); if (blogsEntry == null) { if (_log.isDebugEnabled()) { _log.debug(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); } throw new NoSuchEntryException( _NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey); } return blogsEntry; } /** * Returns the blogs entry with the primary key or throws a NoSuchEntryException if it could not be found. * * @param entryId the primary key of the blogs entry * @return the blogs entry * @throws NoSuchEntryException if a blogs entry with the primary key could not be found */ @Override public BlogsEntry findByPrimaryKey(long entryId) throws NoSuchEntryException { return findByPrimaryKey((Serializable)entryId); } /** * Returns the blogs entry with the primary key or returns null if it could not be found. * * @param entryId the primary key of the blogs entry * @return the blogs entry, or null if a blogs entry with the primary key could not be found */ @Override public BlogsEntry fetchByPrimaryKey(long entryId) { return fetchByPrimaryKey((Serializable)entryId); } /** * Returns all the blogs entries. * * @return the blogs entries */ @Override public List findAll() { return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null); } /** * Returns a range of all the blogs 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @return the range of blogs entries */ @Override public List findAll(int start, int end) { return findAll(start, end, null); } /** * Returns an ordered range of all the blogs 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @return the ordered range of blogs entries */ @Override public List findAll( int start, int end, OrderByComparator orderByComparator) { return findAll(start, end, orderByComparator, true); } /** * Returns an ordered range of all the blogs 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 and pagination is required (start and end are not QueryUtil#ALL_POS), then the query will include the default ORDER BY logic from BlogsEntryModelImpl. If both orderByComparator and pagination are absent, for performance reasons, the query will not have an ORDER BY clause and the returned result set will be sorted on by the primary key in an ascending order. *

* * @param start the lower bound of the range of blogs entries * @param end the upper bound of the range of blogs entries (not inclusive) * @param orderByComparator the comparator to order the results by (optionally null) * @param retrieveFromCache whether to retrieve from the finder cache * @return the ordered range of blogs entries */ @Override public List findAll( int start, int end, OrderByComparator orderByComparator, boolean retrieveFromCache) { boolean pagination = true; FinderPath finderPath = null; Object[] finderArgs = null; if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) && (orderByComparator == null)) { pagination = false; finderPath = _finderPathWithoutPaginationFindAll; finderArgs = FINDER_ARGS_EMPTY; } else { finderPath = _finderPathWithPaginationFindAll; finderArgs = new Object[] {start, end, orderByComparator}; } List list = null; if (retrieveFromCache) { list = (List)finderCache.getResult( finderPath, finderArgs, this); } if (list == null) { StringBundler query = null; String sql = null; if (orderByComparator != null) { query = new StringBundler( 2 + (orderByComparator.getOrderByFields().length * 2)); query.append(_SQL_SELECT_BLOGSENTRY); appendOrderByComparator( query, _ORDER_BY_ENTITY_ALIAS, orderByComparator); sql = query.toString(); } else { sql = _SQL_SELECT_BLOGSENTRY; if (pagination) { sql = sql.concat(BlogsEntryModelImpl.ORDER_BY_JPQL); } } Session session = null; try { session = openSession(); Query q = session.createQuery(sql); if (!pagination) { list = (List)QueryUtil.list( q, getDialect(), start, end, false); Collections.sort(list); list = Collections.unmodifiableList(list); } else { list = (List)QueryUtil.list( q, getDialect(), start, end); } cacheResult(list); finderCache.putResult(finderPath, finderArgs, list); } catch (Exception e) { finderCache.removeResult(finderPath, finderArgs); throw processException(e); } finally { closeSession(session); } } return list; } /** * Removes all the blogs entries from the database. * */ @Override public void removeAll() { for (BlogsEntry blogsEntry : findAll()) { remove(blogsEntry); } } /** * Returns the number of blogs entries. * * @return the number of blogs entries */ @Override public int countAll() { Long count = (Long)finderCache.getResult( _finderPathCountAll, FINDER_ARGS_EMPTY, this); if (count == null) { Session session = null; try { session = openSession(); Query q = session.createQuery(_SQL_COUNT_BLOGSENTRY); count = (Long)q.uniqueResult(); finderCache.putResult( _finderPathCountAll, FINDER_ARGS_EMPTY, count); } catch (Exception e) { finderCache.removeResult( _finderPathCountAll, FINDER_ARGS_EMPTY); throw processException(e); } 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_BLOGSENTRY; } @Override protected Map getTableColumnsMap() { return BlogsEntryModelImpl.TABLE_COLUMNS_MAP; } /** * Initializes the blogs entry persistence. */ @Activate public void activate() { BlogsEntryModelImpl.setEntityCacheEnabled(entityCacheEnabled); BlogsEntryModelImpl.setFinderCacheEnabled(finderCacheEnabled); _finderPathWithPaginationFindAll = new FinderPath( entityCacheEnabled, finderCacheEnabled, BlogsEntryImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0]); _finderPathWithoutPaginationFindAll = new FinderPath( entityCacheEnabled, finderCacheEnabled, BlogsEntryImpl.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0]); _finderPathCountAll = new FinderPath( entityCacheEnabled, finderCacheEnabled, Long.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll", new String[0]); _finderPathWithPaginationFindByUuid = new FinderPath( entityCacheEnabled, finderCacheEnabled, BlogsEntryImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByUuid", new String[] { String.class.getName(), Integer.class.getName(), Integer.class.getName(), OrderByComparator.class.getName() }); _finderPathWithoutPaginationFindByUuid = new FinderPath( entityCacheEnabled, finderCacheEnabled, BlogsEntryImpl.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByUuid", new String[] {String.class.getName()}, BlogsEntryModelImpl.UUID_COLUMN_BITMASK | BlogsEntryModelImpl.DISPLAYDATE_COLUMN_BITMASK | BlogsEntryModelImpl.CREATEDATE_COLUMN_BITMASK); _finderPathCountByUuid = new FinderPath( entityCacheEnabled, finderCacheEnabled, Long.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUuid", new String[] {String.class.getName()}); _finderPathFetchByUUID_G = new FinderPath( entityCacheEnabled, finderCacheEnabled, BlogsEntryImpl.class, FINDER_CLASS_NAME_ENTITY, "fetchByUUID_G", new String[] {String.class.getName(), Long.class.getName()}, BlogsEntryModelImpl.UUID_COLUMN_BITMASK | BlogsEntryModelImpl.GROUPID_COLUMN_BITMASK); _finderPathCountByUUID_G = new FinderPath( entityCacheEnabled, finderCacheEnabled, Long.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUUID_G", new String[] {String.class.getName(), Long.class.getName()}); _finderPathWithPaginationFindByUuid_C = new FinderPath( entityCacheEnabled, finderCacheEnabled, BlogsEntryImpl.class, 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() }); _finderPathWithoutPaginationFindByUuid_C = new FinderPath( entityCacheEnabled, finderCacheEnabled, BlogsEntryImpl.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByUuid_C", new String[] {String.class.getName(), Long.class.getName()}, BlogsEntryModelImpl.UUID_COLUMN_BITMASK | BlogsEntryModelImpl.COMPANYID_COLUMN_BITMASK | BlogsEntryModelImpl.DISPLAYDATE_COLUMN_BITMASK | BlogsEntryModelImpl.CREATEDATE_COLUMN_BITMASK); _finderPathCountByUuid_C = new FinderPath( entityCacheEnabled, finderCacheEnabled, Long.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUuid_C", new String[] {String.class.getName(), Long.class.getName()}); _finderPathWithPaginationFindByGroupId = new FinderPath( entityCacheEnabled, finderCacheEnabled, BlogsEntryImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByGroupId", new String[] { Long.class.getName(), Integer.class.getName(), Integer.class.getName(), OrderByComparator.class.getName() }); _finderPathWithoutPaginationFindByGroupId = new FinderPath( entityCacheEnabled, finderCacheEnabled, BlogsEntryImpl.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByGroupId", new String[] {Long.class.getName()}, BlogsEntryModelImpl.GROUPID_COLUMN_BITMASK | BlogsEntryModelImpl.DISPLAYDATE_COLUMN_BITMASK | BlogsEntryModelImpl.CREATEDATE_COLUMN_BITMASK); _finderPathCountByGroupId = new FinderPath( entityCacheEnabled, finderCacheEnabled, Long.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByGroupId", new String[] {Long.class.getName()}); _finderPathWithPaginationFindByCompanyId = new FinderPath( entityCacheEnabled, finderCacheEnabled, BlogsEntryImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByCompanyId", new String[] { Long.class.getName(), Integer.class.getName(), Integer.class.getName(), OrderByComparator.class.getName() }); _finderPathWithoutPaginationFindByCompanyId = new FinderPath( entityCacheEnabled, finderCacheEnabled, BlogsEntryImpl.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByCompanyId", new String[] {Long.class.getName()}, BlogsEntryModelImpl.COMPANYID_COLUMN_BITMASK | BlogsEntryModelImpl.DISPLAYDATE_COLUMN_BITMASK | BlogsEntryModelImpl.CREATEDATE_COLUMN_BITMASK); _finderPathCountByCompanyId = new FinderPath( entityCacheEnabled, finderCacheEnabled, Long.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByCompanyId", new String[] {Long.class.getName()}); _finderPathFetchByG_UT = new FinderPath( entityCacheEnabled, finderCacheEnabled, BlogsEntryImpl.class, FINDER_CLASS_NAME_ENTITY, "fetchByG_UT", new String[] {Long.class.getName(), String.class.getName()}, BlogsEntryModelImpl.GROUPID_COLUMN_BITMASK | BlogsEntryModelImpl.URLTITLE_COLUMN_BITMASK); _finderPathCountByG_UT = new FinderPath( entityCacheEnabled, finderCacheEnabled, Long.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_UT", new String[] {Long.class.getName(), String.class.getName()}); _finderPathWithPaginationFindByG_LtD = new FinderPath( entityCacheEnabled, finderCacheEnabled, BlogsEntryImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByG_LtD", new String[] { Long.class.getName(), Date.class.getName(), Integer.class.getName(), Integer.class.getName(), OrderByComparator.class.getName() }); _finderPathWithPaginationCountByG_LtD = new FinderPath( entityCacheEnabled, finderCacheEnabled, Long.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "countByG_LtD", new String[] {Long.class.getName(), Date.class.getName()}); _finderPathWithPaginationFindByG_S = new FinderPath( entityCacheEnabled, finderCacheEnabled, BlogsEntryImpl.class, 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() }); _finderPathWithoutPaginationFindByG_S = new FinderPath( entityCacheEnabled, finderCacheEnabled, BlogsEntryImpl.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByG_S", new String[] {Long.class.getName(), Integer.class.getName()}, BlogsEntryModelImpl.GROUPID_COLUMN_BITMASK | BlogsEntryModelImpl.STATUS_COLUMN_BITMASK | BlogsEntryModelImpl.DISPLAYDATE_COLUMN_BITMASK | BlogsEntryModelImpl.CREATEDATE_COLUMN_BITMASK); _finderPathCountByG_S = new FinderPath( entityCacheEnabled, finderCacheEnabled, Long.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_S", new String[] {Long.class.getName(), Integer.class.getName()}); _finderPathWithPaginationFindByG_NotS = new FinderPath( entityCacheEnabled, finderCacheEnabled, BlogsEntryImpl.class, 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() }); _finderPathWithPaginationCountByG_NotS = new FinderPath( entityCacheEnabled, finderCacheEnabled, Long.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "countByG_NotS", new String[] {Long.class.getName(), Integer.class.getName()}); _finderPathWithPaginationFindByC_U = new FinderPath( entityCacheEnabled, finderCacheEnabled, BlogsEntryImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByC_U", new String[] { Long.class.getName(), Long.class.getName(), Integer.class.getName(), Integer.class.getName(), OrderByComparator.class.getName() }); _finderPathWithoutPaginationFindByC_U = new FinderPath( entityCacheEnabled, finderCacheEnabled, BlogsEntryImpl.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByC_U", new String[] {Long.class.getName(), Long.class.getName()}, BlogsEntryModelImpl.COMPANYID_COLUMN_BITMASK | BlogsEntryModelImpl.USERID_COLUMN_BITMASK | BlogsEntryModelImpl.DISPLAYDATE_COLUMN_BITMASK | BlogsEntryModelImpl.CREATEDATE_COLUMN_BITMASK); _finderPathCountByC_U = new FinderPath( entityCacheEnabled, finderCacheEnabled, Long.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_U", new String[] {Long.class.getName(), Long.class.getName()}); _finderPathWithPaginationFindByC_LtD = new FinderPath( entityCacheEnabled, finderCacheEnabled, BlogsEntryImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByC_LtD", new String[] { Long.class.getName(), Date.class.getName(), Integer.class.getName(), Integer.class.getName(), OrderByComparator.class.getName() }); _finderPathWithPaginationCountByC_LtD = new FinderPath( entityCacheEnabled, finderCacheEnabled, Long.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "countByC_LtD", new String[] {Long.class.getName(), Date.class.getName()}); _finderPathWithPaginationFindByC_S = new FinderPath( entityCacheEnabled, finderCacheEnabled, BlogsEntryImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByC_S", new String[] { Long.class.getName(), Integer.class.getName(), Integer.class.getName(), Integer.class.getName(), OrderByComparator.class.getName() }); _finderPathWithoutPaginationFindByC_S = new FinderPath( entityCacheEnabled, finderCacheEnabled, BlogsEntryImpl.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByC_S", new String[] {Long.class.getName(), Integer.class.getName()}, BlogsEntryModelImpl.COMPANYID_COLUMN_BITMASK | BlogsEntryModelImpl.STATUS_COLUMN_BITMASK | BlogsEntryModelImpl.DISPLAYDATE_COLUMN_BITMASK | BlogsEntryModelImpl.CREATEDATE_COLUMN_BITMASK); _finderPathCountByC_S = new FinderPath( entityCacheEnabled, finderCacheEnabled, Long.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_S", new String[] {Long.class.getName(), Integer.class.getName()}); _finderPathWithPaginationFindByC_NotS = new FinderPath( entityCacheEnabled, finderCacheEnabled, BlogsEntryImpl.class, 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() }); _finderPathWithPaginationCountByC_NotS = new FinderPath( entityCacheEnabled, finderCacheEnabled, Long.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "countByC_NotS", new String[] {Long.class.getName(), Integer.class.getName()}); _finderPathWithPaginationFindByLtD_S = new FinderPath( entityCacheEnabled, finderCacheEnabled, BlogsEntryImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByLtD_S", new String[] { Date.class.getName(), Integer.class.getName(), Integer.class.getName(), Integer.class.getName(), OrderByComparator.class.getName() }); _finderPathWithPaginationCountByLtD_S = new FinderPath( entityCacheEnabled, finderCacheEnabled, Long.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "countByLtD_S", new String[] {Date.class.getName(), Integer.class.getName()}); _finderPathWithPaginationFindByG_U_LtD = new FinderPath( entityCacheEnabled, finderCacheEnabled, BlogsEntryImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByG_U_LtD", new String[] { Long.class.getName(), Long.class.getName(), Date.class.getName(), Integer.class.getName(), Integer.class.getName(), OrderByComparator.class.getName() }); _finderPathWithPaginationCountByG_U_LtD = new FinderPath( entityCacheEnabled, finderCacheEnabled, Long.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "countByG_U_LtD", new String[] { Long.class.getName(), Long.class.getName(), Date.class.getName() }); _finderPathWithPaginationFindByG_U_S = new FinderPath( entityCacheEnabled, finderCacheEnabled, BlogsEntryImpl.class, 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() }); _finderPathWithoutPaginationFindByG_U_S = new FinderPath( entityCacheEnabled, finderCacheEnabled, BlogsEntryImpl.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByG_U_S", new String[] { Long.class.getName(), Long.class.getName(), Integer.class.getName() }, BlogsEntryModelImpl.GROUPID_COLUMN_BITMASK | BlogsEntryModelImpl.USERID_COLUMN_BITMASK | BlogsEntryModelImpl.STATUS_COLUMN_BITMASK | BlogsEntryModelImpl.DISPLAYDATE_COLUMN_BITMASK | BlogsEntryModelImpl.CREATEDATE_COLUMN_BITMASK); _finderPathCountByG_U_S = new FinderPath( entityCacheEnabled, finderCacheEnabled, Long.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_U_S", new String[] { Long.class.getName(), Long.class.getName(), Integer.class.getName() }); _finderPathWithPaginationCountByG_U_S = new FinderPath( entityCacheEnabled, finderCacheEnabled, Long.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "countByG_U_S", new String[] { Long.class.getName(), Long.class.getName(), Integer.class.getName() }); _finderPathWithPaginationFindByG_U_NotS = new FinderPath( entityCacheEnabled, finderCacheEnabled, BlogsEntryImpl.class, 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() }); _finderPathWithPaginationCountByG_U_NotS = new FinderPath( entityCacheEnabled, finderCacheEnabled, Long.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "countByG_U_NotS", new String[] { Long.class.getName(), Long.class.getName(), Integer.class.getName() }); _finderPathWithPaginationFindByG_D_S = new FinderPath( entityCacheEnabled, finderCacheEnabled, BlogsEntryImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByG_D_S", new String[] { Long.class.getName(), Date.class.getName(), Integer.class.getName(), Integer.class.getName(), Integer.class.getName(), OrderByComparator.class.getName() }); _finderPathWithoutPaginationFindByG_D_S = new FinderPath( entityCacheEnabled, finderCacheEnabled, BlogsEntryImpl.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByG_D_S", new String[] { Long.class.getName(), Date.class.getName(), Integer.class.getName() }, BlogsEntryModelImpl.GROUPID_COLUMN_BITMASK | BlogsEntryModelImpl.DISPLAYDATE_COLUMN_BITMASK | BlogsEntryModelImpl.STATUS_COLUMN_BITMASK | BlogsEntryModelImpl.CREATEDATE_COLUMN_BITMASK); _finderPathCountByG_D_S = new FinderPath( entityCacheEnabled, finderCacheEnabled, Long.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByG_D_S", new String[] { Long.class.getName(), Date.class.getName(), Integer.class.getName() }); _finderPathWithPaginationFindByG_GtD_S = new FinderPath( entityCacheEnabled, finderCacheEnabled, BlogsEntryImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByG_GtD_S", new String[] { Long.class.getName(), Date.class.getName(), Integer.class.getName(), Integer.class.getName(), Integer.class.getName(), OrderByComparator.class.getName() }); _finderPathWithPaginationCountByG_GtD_S = new FinderPath( entityCacheEnabled, finderCacheEnabled, Long.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "countByG_GtD_S", new String[] { Long.class.getName(), Date.class.getName(), Integer.class.getName() }); _finderPathWithPaginationFindByG_LtD_S = new FinderPath( entityCacheEnabled, finderCacheEnabled, BlogsEntryImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByG_LtD_S", new String[] { Long.class.getName(), Date.class.getName(), Integer.class.getName(), Integer.class.getName(), Integer.class.getName(), OrderByComparator.class.getName() }); _finderPathWithPaginationCountByG_LtD_S = new FinderPath( entityCacheEnabled, finderCacheEnabled, Long.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "countByG_LtD_S", new String[] { Long.class.getName(), Date.class.getName(), Integer.class.getName() }); _finderPathWithPaginationFindByG_LtD_NotS = new FinderPath( entityCacheEnabled, finderCacheEnabled, BlogsEntryImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByG_LtD_NotS", new String[] { Long.class.getName(), Date.class.getName(), Integer.class.getName(), Integer.class.getName(), Integer.class.getName(), OrderByComparator.class.getName() }); _finderPathWithPaginationCountByG_LtD_NotS = new FinderPath( entityCacheEnabled, finderCacheEnabled, Long.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "countByG_LtD_NotS", new String[] { Long.class.getName(), Date.class.getName(), Integer.class.getName() }); _finderPathWithPaginationFindByC_U_S = new FinderPath( entityCacheEnabled, finderCacheEnabled, BlogsEntryImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByC_U_S", new String[] { Long.class.getName(), Long.class.getName(), Integer.class.getName(), Integer.class.getName(), Integer.class.getName(), OrderByComparator.class.getName() }); _finderPathWithoutPaginationFindByC_U_S = new FinderPath( entityCacheEnabled, finderCacheEnabled, BlogsEntryImpl.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByC_U_S", new String[] { Long.class.getName(), Long.class.getName(), Integer.class.getName() }, BlogsEntryModelImpl.COMPANYID_COLUMN_BITMASK | BlogsEntryModelImpl.USERID_COLUMN_BITMASK | BlogsEntryModelImpl.STATUS_COLUMN_BITMASK | BlogsEntryModelImpl.DISPLAYDATE_COLUMN_BITMASK | BlogsEntryModelImpl.CREATEDATE_COLUMN_BITMASK); _finderPathCountByC_U_S = new FinderPath( entityCacheEnabled, finderCacheEnabled, Long.class, FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByC_U_S", new String[] { Long.class.getName(), Long.class.getName(), Integer.class.getName() }); _finderPathWithPaginationFindByC_U_NotS = new FinderPath( entityCacheEnabled, finderCacheEnabled, BlogsEntryImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByC_U_NotS", new String[] { Long.class.getName(), Long.class.getName(), Integer.class.getName(), Integer.class.getName(), Integer.class.getName(), OrderByComparator.class.getName() }); _finderPathWithPaginationCountByC_U_NotS = new FinderPath( entityCacheEnabled, finderCacheEnabled, Long.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "countByC_U_NotS", new String[] { Long.class.getName(), Long.class.getName(), Integer.class.getName() }); _finderPathWithPaginationFindByC_LtD_S = new FinderPath( entityCacheEnabled, finderCacheEnabled, BlogsEntryImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByC_LtD_S", new String[] { Long.class.getName(), Date.class.getName(), Integer.class.getName(), Integer.class.getName(), Integer.class.getName(), OrderByComparator.class.getName() }); _finderPathWithPaginationCountByC_LtD_S = new FinderPath( entityCacheEnabled, finderCacheEnabled, Long.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "countByC_LtD_S", new String[] { Long.class.getName(), Date.class.getName(), Integer.class.getName() }); _finderPathWithPaginationFindByC_LtD_NotS = new FinderPath( entityCacheEnabled, finderCacheEnabled, BlogsEntryImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByC_LtD_NotS", new String[] { Long.class.getName(), Date.class.getName(), Integer.class.getName(), Integer.class.getName(), Integer.class.getName(), OrderByComparator.class.getName() }); _finderPathWithPaginationCountByC_LtD_NotS = new FinderPath( entityCacheEnabled, finderCacheEnabled, Long.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "countByC_LtD_NotS", new String[] { Long.class.getName(), Date.class.getName(), Integer.class.getName() }); _finderPathWithPaginationFindByG_U_LtD_S = new FinderPath( entityCacheEnabled, finderCacheEnabled, BlogsEntryImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByG_U_LtD_S", new String[] { Long.class.getName(), Long.class.getName(), Date.class.getName(), Integer.class.getName(), Integer.class.getName(), Integer.class.getName(), OrderByComparator.class.getName() }); _finderPathWithPaginationCountByG_U_LtD_S = new FinderPath( entityCacheEnabled, finderCacheEnabled, Long.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "countByG_U_LtD_S", new String[] { Long.class.getName(), Long.class.getName(), Date.class.getName(), Integer.class.getName() }); _finderPathWithPaginationFindByG_U_LtD_NotS = new FinderPath( entityCacheEnabled, finderCacheEnabled, BlogsEntryImpl.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByG_U_LtD_NotS", new String[] { Long.class.getName(), Long.class.getName(), Date.class.getName(), Integer.class.getName(), Integer.class.getName(), Integer.class.getName(), OrderByComparator.class.getName() }); _finderPathWithPaginationCountByG_U_LtD_NotS = new FinderPath( entityCacheEnabled, finderCacheEnabled, Long.class, FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "countByG_U_LtD_NotS", new String[] { Long.class.getName(), Long.class.getName(), Date.class.getName(), Integer.class.getName() }); } @Deactivate public void deactivate() { entityCache.removeCache(BlogsEntryImpl.class.getName()); finderCache.removeCache(FINDER_CLASS_NAME_ENTITY); finderCache.removeCache(FINDER_CLASS_NAME_LIST_WITH_PAGINATION); finderCache.removeCache(FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION); } @Override @Reference( target = BlogsPersistenceConstants.ORIGIN_BUNDLE_SYMBOLIC_NAME_FILTER, unbind = "-" ) public void setConfiguration(Configuration configuration) { super.setConfiguration(configuration); _columnBitmaskEnabled = GetterUtil.getBoolean( configuration.get( "value.object.column.bitmask.enabled.com.liferay.blogs.model.BlogsEntry"), true); } @Override @Reference( target = BlogsPersistenceConstants.ORIGIN_BUNDLE_SYMBOLIC_NAME_FILTER, unbind = "-" ) public void setDataSource(DataSource dataSource) { super.setDataSource(dataSource); } @Override @Reference( target = BlogsPersistenceConstants.ORIGIN_BUNDLE_SYMBOLIC_NAME_FILTER, unbind = "-" ) public void setSessionFactory(SessionFactory sessionFactory) { super.setSessionFactory(sessionFactory); } private boolean _columnBitmaskEnabled; @Reference protected EntityCache entityCache; @Reference protected FinderCache finderCache; private Long _getTime(Date date) { if (date == null) { return null; } return date.getTime(); } private static final String _SQL_SELECT_BLOGSENTRY = "SELECT blogsEntry FROM BlogsEntry blogsEntry"; private static final String _SQL_SELECT_BLOGSENTRY_WHERE = "SELECT blogsEntry FROM BlogsEntry blogsEntry WHERE "; private static final String _SQL_COUNT_BLOGSENTRY = "SELECT COUNT(blogsEntry) FROM BlogsEntry blogsEntry"; private static final String _SQL_COUNT_BLOGSENTRY_WHERE = "SELECT COUNT(blogsEntry) FROM BlogsEntry blogsEntry WHERE "; private static final String _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN = "blogsEntry.entryId"; private static final String _FILTER_SQL_SELECT_BLOGSENTRY_WHERE = "SELECT DISTINCT {blogsEntry.*} FROM BlogsEntry blogsEntry WHERE "; private static final String _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_1 = "SELECT {BlogsEntry.*} FROM (SELECT DISTINCT blogsEntry.entryId FROM BlogsEntry blogsEntry WHERE "; private static final String _FILTER_SQL_SELECT_BLOGSENTRY_NO_INLINE_DISTINCT_WHERE_2 = ") TEMP_TABLE INNER JOIN BlogsEntry ON TEMP_TABLE.entryId = BlogsEntry.entryId"; private static final String _FILTER_SQL_COUNT_BLOGSENTRY_WHERE = "SELECT COUNT(DISTINCT blogsEntry.entryId) AS COUNT_VALUE FROM BlogsEntry blogsEntry WHERE "; private static final String _FILTER_ENTITY_ALIAS = "blogsEntry"; private static final String _FILTER_ENTITY_TABLE = "BlogsEntry"; private static final String _ORDER_BY_ENTITY_ALIAS = "blogsEntry."; private static final String _ORDER_BY_ENTITY_TABLE = "BlogsEntry."; private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY = "No BlogsEntry exists with the primary key "; private static final String _NO_SUCH_ENTITY_WITH_KEY = "No BlogsEntry exists with the key {"; private static final Log _log = LogFactoryUtil.getLog( BlogsEntryPersistenceImpl.class); private static final Set _badColumnNames = SetUtil.fromArray( new String[] {"uuid"}); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy