com.liferay.commerce.pricing.service.persistence.impl.CommercePricingClassPersistenceImpl Maven / Gradle / Ivy
Show all versions of com.liferay.commerce.pricing.service
/**
* SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
*/
package com.liferay.commerce.pricing.service.persistence.impl;
import com.liferay.commerce.pricing.exception.DuplicateCommercePricingClassExternalReferenceCodeException;
import com.liferay.commerce.pricing.exception.NoSuchPricingClassException;
import com.liferay.commerce.pricing.model.CommercePricingClass;
import com.liferay.commerce.pricing.model.CommercePricingClassTable;
import com.liferay.commerce.pricing.model.impl.CommercePricingClassImpl;
import com.liferay.commerce.pricing.model.impl.CommercePricingClassModelImpl;
import com.liferay.commerce.pricing.service.persistence.CommercePricingClassPersistence;
import com.liferay.commerce.pricing.service.persistence.CommercePricingClassUtil;
import com.liferay.commerce.pricing.service.persistence.impl.constants.CommercePersistenceConstants;
import com.liferay.petra.lang.SafeCloseable;
import com.liferay.petra.string.StringBundler;
import com.liferay.portal.kernel.change.tracking.CTCollectionThreadLocal;
import com.liferay.portal.kernel.change.tracking.CTColumnResolutionType;
import com.liferay.portal.kernel.configuration.Configuration;
import com.liferay.portal.kernel.dao.orm.EntityCache;
import com.liferay.portal.kernel.dao.orm.FinderCache;
import com.liferay.portal.kernel.dao.orm.FinderPath;
import com.liferay.portal.kernel.dao.orm.Query;
import com.liferay.portal.kernel.dao.orm.QueryPos;
import com.liferay.portal.kernel.dao.orm.QueryUtil;
import com.liferay.portal.kernel.dao.orm.SQLQuery;
import com.liferay.portal.kernel.dao.orm.Session;
import com.liferay.portal.kernel.dao.orm.SessionFactory;
import com.liferay.portal.kernel.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.change.tracking.helper.CTPersistenceHelper;
import com.liferay.portal.kernel.service.persistence.impl.BasePersistenceImpl;
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.PropsKeys;
import com.liferay.portal.kernel.util.PropsUtil;
import com.liferay.portal.kernel.util.ProxyUtil;
import com.liferay.portal.kernel.util.SetUtil;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.kernel.uuid.PortalUUIDUtil;
import java.io.Serializable;
import java.lang.reflect.InvocationHandler;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.EnumMap;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import javax.sql.DataSource;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Deactivate;
import org.osgi.service.component.annotations.Reference;
/**
* The persistence implementation for the commerce pricing class service.
*
*
* Caching information and settings can be found in portal.properties
*
*
* @author Riccardo Alberti
* @generated
*/
@Component(service = CommercePricingClassPersistence.class)
public class CommercePricingClassPersistenceImpl
extends BasePersistenceImpl
implements CommercePricingClassPersistence {
/*
* NOTE FOR DEVELOPERS:
*
* Never modify or reference this class directly. Always use CommercePricingClassUtil
to access the commerce pricing class persistence. Modify service.xml
and rerun ServiceBuilder to regenerate this class.
*/
public static final String FINDER_CLASS_NAME_ENTITY =
CommercePricingClassImpl.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 commerce pricing classes where uuid = ?.
*
* @param uuid the uuid
* @return the matching commerce pricing classes
*/
@Override
public List findByUuid(String uuid) {
return findByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
}
/**
* Returns a range of all the commerce pricing classes where uuid = ?.
*
*
* Useful when paginating results. Returns a maximum of end - start
instances. start
and end
are not primary keys, they are indexes in the result set. Thus, 0
refers to the first result in the set. Setting both start
and end
to QueryUtil#ALL_POS
will return the full result set. If orderByComparator
is specified, then the query will include the given ORDER BY logic. If orderByComparator
is absent, then the query will include the default ORDER BY logic from CommercePricingClassModelImpl
.
*
*
* @param uuid the uuid
* @param start the lower bound of the range of commerce pricing classes
* @param end the upper bound of the range of commerce pricing classes (not inclusive)
* @return the range of matching commerce pricing classes
*/
@Override
public List findByUuid(
String uuid, int start, int end) {
return findByUuid(uuid, start, end, null);
}
/**
* Returns an ordered range of all the commerce pricing classes where uuid = ?.
*
*
* Useful when paginating results. Returns a maximum of end - start
instances. start
and end
are not primary keys, they are indexes in the result set. Thus, 0
refers to the first result in the set. Setting both start
and end
to QueryUtil#ALL_POS
will return the full result set. If orderByComparator
is specified, then the query will include the given ORDER BY logic. If orderByComparator
is absent, then the query will include the default ORDER BY logic from CommercePricingClassModelImpl
.
*
*
* @param uuid the uuid
* @param start the lower bound of the range of commerce pricing classes
* @param end the upper bound of the range of commerce pricing classes (not inclusive)
* @param orderByComparator the comparator to order the results by (optionally null
)
* @return the ordered range of matching commerce pricing classes
*/
@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 commerce pricing classes where uuid = ?.
*
*
* Useful when paginating results. Returns a maximum of end - start
instances. start
and end
are not primary keys, they are indexes in the result set. Thus, 0
refers to the first result in the set. Setting both start
and end
to QueryUtil#ALL_POS
will return the full result set. If orderByComparator
is specified, then the query will include the given ORDER BY logic. If orderByComparator
is absent, then the query will include the default ORDER BY logic from CommercePricingClassModelImpl
.
*
*
* @param uuid the uuid
* @param start the lower bound of the range of commerce pricing classes
* @param end the upper bound of the range of commerce pricing classes (not inclusive)
* @param orderByComparator the comparator to order the results by (optionally null
)
* @param useFinderCache whether to use the finder cache
* @return the ordered range of matching commerce pricing classes
*/
@Override
public List findByUuid(
String uuid, int start, int end,
OrderByComparator orderByComparator,
boolean useFinderCache) {
try (SafeCloseable safeCloseable =
ctPersistenceHelper.setCTCollectionIdWithSafeCloseable(
CommercePricingClass.class)) {
uuid = Objects.toString(uuid, "");
FinderPath finderPath = null;
Object[] finderArgs = null;
if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
(orderByComparator == null)) {
if (useFinderCache) {
finderPath = _finderPathWithoutPaginationFindByUuid;
finderArgs = new Object[] {uuid};
}
}
else if (useFinderCache) {
finderPath = _finderPathWithPaginationFindByUuid;
finderArgs = new Object[] {uuid, start, end, orderByComparator};
}
List list = null;
if (useFinderCache) {
list = (List)finderCache.getResult(
finderPath, finderArgs, this);
if ((list != null) && !list.isEmpty()) {
for (CommercePricingClass commercePricingClass : list) {
if (!uuid.equals(commercePricingClass.getUuid())) {
list = null;
break;
}
}
}
}
if (list == null) {
StringBundler sb = null;
if (orderByComparator != null) {
sb = new StringBundler(
3 + (orderByComparator.getOrderByFields().length * 2));
}
else {
sb = new StringBundler(3);
}
sb.append(_SQL_SELECT_COMMERCEPRICINGCLASS_WHERE);
boolean bindUuid = false;
if (uuid.isEmpty()) {
sb.append(_FINDER_COLUMN_UUID_UUID_3);
}
else {
bindUuid = true;
sb.append(_FINDER_COLUMN_UUID_UUID_2);
}
if (orderByComparator != null) {
appendOrderByComparator(
sb, _ORDER_BY_ENTITY_ALIAS, orderByComparator);
}
else {
sb.append(CommercePricingClassModelImpl.ORDER_BY_JPQL);
}
String sql = sb.toString();
Session session = null;
try {
session = openSession();
Query query = session.createQuery(sql);
QueryPos queryPos = QueryPos.getInstance(query);
if (bindUuid) {
queryPos.add(uuid);
}
list = (List)QueryUtil.list(
query, getDialect(), start, end);
cacheResult(list);
if (useFinderCache) {
finderCache.putResult(finderPath, finderArgs, list);
}
}
catch (Exception exception) {
throw processException(exception);
}
finally {
closeSession(session);
}
}
return list;
}
}
/**
* Returns the first commerce pricing class 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 commerce pricing class
* @throws NoSuchPricingClassException if a matching commerce pricing class could not be found
*/
@Override
public CommercePricingClass findByUuid_First(
String uuid,
OrderByComparator orderByComparator)
throws NoSuchPricingClassException {
CommercePricingClass commercePricingClass = fetchByUuid_First(
uuid, orderByComparator);
if (commercePricingClass != null) {
return commercePricingClass;
}
StringBundler sb = new StringBundler(4);
sb.append(_NO_SUCH_ENTITY_WITH_KEY);
sb.append("uuid=");
sb.append(uuid);
sb.append("}");
throw new NoSuchPricingClassException(sb.toString());
}
/**
* Returns the first commerce pricing class 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 commerce pricing class, or null
if a matching commerce pricing class could not be found
*/
@Override
public CommercePricingClass 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 commerce pricing class 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 commerce pricing class
* @throws NoSuchPricingClassException if a matching commerce pricing class could not be found
*/
@Override
public CommercePricingClass findByUuid_Last(
String uuid,
OrderByComparator orderByComparator)
throws NoSuchPricingClassException {
CommercePricingClass commercePricingClass = fetchByUuid_Last(
uuid, orderByComparator);
if (commercePricingClass != null) {
return commercePricingClass;
}
StringBundler sb = new StringBundler(4);
sb.append(_NO_SUCH_ENTITY_WITH_KEY);
sb.append("uuid=");
sb.append(uuid);
sb.append("}");
throw new NoSuchPricingClassException(sb.toString());
}
/**
* Returns the last commerce pricing class 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 commerce pricing class, or null
if a matching commerce pricing class could not be found
*/
@Override
public CommercePricingClass 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 commerce pricing classes before and after the current commerce pricing class in the ordered set where uuid = ?.
*
* @param commercePricingClassId the primary key of the current commerce pricing class
* @param uuid the uuid
* @param orderByComparator the comparator to order the set by (optionally null
)
* @return the previous, current, and next commerce pricing class
* @throws NoSuchPricingClassException if a commerce pricing class with the primary key could not be found
*/
@Override
public CommercePricingClass[] findByUuid_PrevAndNext(
long commercePricingClassId, String uuid,
OrderByComparator orderByComparator)
throws NoSuchPricingClassException {
uuid = Objects.toString(uuid, "");
CommercePricingClass commercePricingClass = findByPrimaryKey(
commercePricingClassId);
Session session = null;
try {
session = openSession();
CommercePricingClass[] array = new CommercePricingClassImpl[3];
array[0] = getByUuid_PrevAndNext(
session, commercePricingClass, uuid, orderByComparator, true);
array[1] = commercePricingClass;
array[2] = getByUuid_PrevAndNext(
session, commercePricingClass, uuid, orderByComparator, false);
return array;
}
catch (Exception exception) {
throw processException(exception);
}
finally {
closeSession(session);
}
}
protected CommercePricingClass getByUuid_PrevAndNext(
Session session, CommercePricingClass commercePricingClass, String uuid,
OrderByComparator orderByComparator,
boolean previous) {
StringBundler sb = null;
if (orderByComparator != null) {
sb = new StringBundler(
4 + (orderByComparator.getOrderByConditionFields().length * 3) +
(orderByComparator.getOrderByFields().length * 3));
}
else {
sb = new StringBundler(3);
}
sb.append(_SQL_SELECT_COMMERCEPRICINGCLASS_WHERE);
boolean bindUuid = false;
if (uuid.isEmpty()) {
sb.append(_FINDER_COLUMN_UUID_UUID_3);
}
else {
bindUuid = true;
sb.append(_FINDER_COLUMN_UUID_UUID_2);
}
if (orderByComparator != null) {
String[] orderByConditionFields =
orderByComparator.getOrderByConditionFields();
if (orderByConditionFields.length > 0) {
sb.append(WHERE_AND);
}
for (int i = 0; i < orderByConditionFields.length; i++) {
sb.append(_ORDER_BY_ENTITY_ALIAS);
sb.append(orderByConditionFields[i]);
if ((i + 1) < orderByConditionFields.length) {
if (orderByComparator.isAscending() ^ previous) {
sb.append(WHERE_GREATER_THAN_HAS_NEXT);
}
else {
sb.append(WHERE_LESSER_THAN_HAS_NEXT);
}
}
else {
if (orderByComparator.isAscending() ^ previous) {
sb.append(WHERE_GREATER_THAN);
}
else {
sb.append(WHERE_LESSER_THAN);
}
}
}
sb.append(ORDER_BY_CLAUSE);
String[] orderByFields = orderByComparator.getOrderByFields();
for (int i = 0; i < orderByFields.length; i++) {
sb.append(_ORDER_BY_ENTITY_ALIAS);
sb.append(orderByFields[i]);
if ((i + 1) < orderByFields.length) {
if (orderByComparator.isAscending() ^ previous) {
sb.append(ORDER_BY_ASC_HAS_NEXT);
}
else {
sb.append(ORDER_BY_DESC_HAS_NEXT);
}
}
else {
if (orderByComparator.isAscending() ^ previous) {
sb.append(ORDER_BY_ASC);
}
else {
sb.append(ORDER_BY_DESC);
}
}
}
}
else {
sb.append(CommercePricingClassModelImpl.ORDER_BY_JPQL);
}
String sql = sb.toString();
Query query = session.createQuery(sql);
query.setFirstResult(0);
query.setMaxResults(2);
QueryPos queryPos = QueryPos.getInstance(query);
if (bindUuid) {
queryPos.add(uuid);
}
if (orderByComparator != null) {
for (Object orderByConditionValue :
orderByComparator.getOrderByConditionValues(
commercePricingClass)) {
queryPos.add(orderByConditionValue);
}
}
List list = query.list();
if (list.size() == 2) {
return list.get(1);
}
else {
return null;
}
}
/**
* Returns all the commerce pricing classes that the user has permission to view where uuid = ?.
*
* @param uuid the uuid
* @return the matching commerce pricing classes that the user has permission to view
*/
@Override
public List filterFindByUuid(String uuid) {
return filterFindByUuid(
uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
}
/**
* Returns a range of all the commerce pricing classes that the user has permission to view where uuid = ?.
*
*
* Useful when paginating results. Returns a maximum of end - start
instances. start
and end
are not primary keys, they are indexes in the result set. Thus, 0
refers to the first result in the set. Setting both start
and end
to QueryUtil#ALL_POS
will return the full result set. If orderByComparator
is specified, then the query will include the given ORDER BY logic. If orderByComparator
is absent, then the query will include the default ORDER BY logic from CommercePricingClassModelImpl
.
*
*
* @param uuid the uuid
* @param start the lower bound of the range of commerce pricing classes
* @param end the upper bound of the range of commerce pricing classes (not inclusive)
* @return the range of matching commerce pricing classes that the user has permission to view
*/
@Override
public List filterFindByUuid(
String uuid, int start, int end) {
return filterFindByUuid(uuid, start, end, null);
}
/**
* Returns an ordered range of all the commerce pricing classes that the user has permissions to view where uuid = ?.
*
*
* Useful when paginating results. Returns a maximum of end - start
instances. start
and end
are not primary keys, they are indexes in the result set. Thus, 0
refers to the first result in the set. Setting both start
and end
to QueryUtil#ALL_POS
will return the full result set. If orderByComparator
is specified, then the query will include the given ORDER BY logic. If orderByComparator
is absent, then the query will include the default ORDER BY logic from CommercePricingClassModelImpl
.
*
*
* @param uuid the uuid
* @param start the lower bound of the range of commerce pricing classes
* @param end the upper bound of the range of commerce pricing classes (not inclusive)
* @param orderByComparator the comparator to order the results by (optionally null
)
* @return the ordered range of matching commerce pricing classes that the user has permission to view
*/
@Override
public List filterFindByUuid(
String uuid, int start, int end,
OrderByComparator orderByComparator) {
if (!InlineSQLHelperUtil.isEnabled()) {
return findByUuid(uuid, start, end, orderByComparator);
}
uuid = Objects.toString(uuid, "");
StringBundler sb = null;
if (orderByComparator != null) {
sb = new StringBundler(
3 + (orderByComparator.getOrderByFields().length * 2));
}
else {
sb = new StringBundler(4);
}
if (getDB().isSupportsInlineDistinct()) {
sb.append(_FILTER_SQL_SELECT_COMMERCEPRICINGCLASS_WHERE);
}
else {
sb.append(
_FILTER_SQL_SELECT_COMMERCEPRICINGCLASS_NO_INLINE_DISTINCT_WHERE_1);
}
boolean bindUuid = false;
if (uuid.isEmpty()) {
sb.append(_FINDER_COLUMN_UUID_UUID_3_SQL);
}
else {
bindUuid = true;
sb.append(_FINDER_COLUMN_UUID_UUID_2_SQL);
}
if (!getDB().isSupportsInlineDistinct()) {
sb.append(
_FILTER_SQL_SELECT_COMMERCEPRICINGCLASS_NO_INLINE_DISTINCT_WHERE_2);
}
if (orderByComparator != null) {
if (getDB().isSupportsInlineDistinct()) {
appendOrderByComparator(
sb, _ORDER_BY_ENTITY_ALIAS, orderByComparator, true);
}
else {
appendOrderByComparator(
sb, _ORDER_BY_ENTITY_TABLE, orderByComparator, true);
}
}
else {
if (getDB().isSupportsInlineDistinct()) {
sb.append(
CommercePricingClassModelImpl.ORDER_BY_SQL_INLINE_DISTINCT);
}
else {
sb.append(CommercePricingClassModelImpl.ORDER_BY_SQL);
}
}
String sql = InlineSQLHelperUtil.replacePermissionCheck(
sb.toString(), CommercePricingClass.class.getName(),
_FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
Session session = null;
try {
session = openSession();
SQLQuery sqlQuery = session.createSynchronizedSQLQuery(sql);
if (getDB().isSupportsInlineDistinct()) {
sqlQuery.addEntity(
_FILTER_ENTITY_ALIAS, CommercePricingClassImpl.class);
}
else {
sqlQuery.addEntity(
_FILTER_ENTITY_TABLE, CommercePricingClassImpl.class);
}
QueryPos queryPos = QueryPos.getInstance(sqlQuery);
if (bindUuid) {
queryPos.add(uuid);
}
return (List)QueryUtil.list(
sqlQuery, getDialect(), start, end);
}
catch (Exception exception) {
throw processException(exception);
}
finally {
closeSession(session);
}
}
/**
* Returns the commerce pricing classes before and after the current commerce pricing class in the ordered set of commerce pricing classes that the user has permission to view where uuid = ?.
*
* @param commercePricingClassId the primary key of the current commerce pricing class
* @param uuid the uuid
* @param orderByComparator the comparator to order the set by (optionally null
)
* @return the previous, current, and next commerce pricing class
* @throws NoSuchPricingClassException if a commerce pricing class with the primary key could not be found
*/
@Override
public CommercePricingClass[] filterFindByUuid_PrevAndNext(
long commercePricingClassId, String uuid,
OrderByComparator orderByComparator)
throws NoSuchPricingClassException {
if (!InlineSQLHelperUtil.isEnabled()) {
return findByUuid_PrevAndNext(
commercePricingClassId, uuid, orderByComparator);
}
uuid = Objects.toString(uuid, "");
CommercePricingClass commercePricingClass = findByPrimaryKey(
commercePricingClassId);
Session session = null;
try {
session = openSession();
CommercePricingClass[] array = new CommercePricingClassImpl[3];
array[0] = filterGetByUuid_PrevAndNext(
session, commercePricingClass, uuid, orderByComparator, true);
array[1] = commercePricingClass;
array[2] = filterGetByUuid_PrevAndNext(
session, commercePricingClass, uuid, orderByComparator, false);
return array;
}
catch (Exception exception) {
throw processException(exception);
}
finally {
closeSession(session);
}
}
protected CommercePricingClass filterGetByUuid_PrevAndNext(
Session session, CommercePricingClass commercePricingClass, String uuid,
OrderByComparator orderByComparator,
boolean previous) {
StringBundler sb = null;
if (orderByComparator != null) {
sb = new StringBundler(
5 + (orderByComparator.getOrderByConditionFields().length * 3) +
(orderByComparator.getOrderByFields().length * 3));
}
else {
sb = new StringBundler(4);
}
if (getDB().isSupportsInlineDistinct()) {
sb.append(_FILTER_SQL_SELECT_COMMERCEPRICINGCLASS_WHERE);
}
else {
sb.append(
_FILTER_SQL_SELECT_COMMERCEPRICINGCLASS_NO_INLINE_DISTINCT_WHERE_1);
}
boolean bindUuid = false;
if (uuid.isEmpty()) {
sb.append(_FINDER_COLUMN_UUID_UUID_3_SQL);
}
else {
bindUuid = true;
sb.append(_FINDER_COLUMN_UUID_UUID_2_SQL);
}
if (!getDB().isSupportsInlineDistinct()) {
sb.append(
_FILTER_SQL_SELECT_COMMERCEPRICINGCLASS_NO_INLINE_DISTINCT_WHERE_2);
}
if (orderByComparator != null) {
String[] orderByConditionFields =
orderByComparator.getOrderByConditionFields();
if (orderByConditionFields.length > 0) {
sb.append(WHERE_AND);
}
for (int i = 0; i < orderByConditionFields.length; i++) {
if (getDB().isSupportsInlineDistinct()) {
sb.append(
getColumnName(
_ORDER_BY_ENTITY_ALIAS, orderByConditionFields[i],
true));
}
else {
sb.append(
getColumnName(
_ORDER_BY_ENTITY_TABLE, orderByConditionFields[i],
true));
}
if ((i + 1) < orderByConditionFields.length) {
if (orderByComparator.isAscending() ^ previous) {
sb.append(WHERE_GREATER_THAN_HAS_NEXT);
}
else {
sb.append(WHERE_LESSER_THAN_HAS_NEXT);
}
}
else {
if (orderByComparator.isAscending() ^ previous) {
sb.append(WHERE_GREATER_THAN);
}
else {
sb.append(WHERE_LESSER_THAN);
}
}
}
sb.append(ORDER_BY_CLAUSE);
String[] orderByFields = orderByComparator.getOrderByFields();
for (int i = 0; i < orderByFields.length; i++) {
if (getDB().isSupportsInlineDistinct()) {
sb.append(
getColumnName(
_ORDER_BY_ENTITY_ALIAS, orderByFields[i], true));
}
else {
sb.append(
getColumnName(
_ORDER_BY_ENTITY_TABLE, orderByFields[i], true));
}
if ((i + 1) < orderByFields.length) {
if (orderByComparator.isAscending() ^ previous) {
sb.append(ORDER_BY_ASC_HAS_NEXT);
}
else {
sb.append(ORDER_BY_DESC_HAS_NEXT);
}
}
else {
if (orderByComparator.isAscending() ^ previous) {
sb.append(ORDER_BY_ASC);
}
else {
sb.append(ORDER_BY_DESC);
}
}
}
}
else {
if (getDB().isSupportsInlineDistinct()) {
sb.append(
CommercePricingClassModelImpl.ORDER_BY_SQL_INLINE_DISTINCT);
}
else {
sb.append(CommercePricingClassModelImpl.ORDER_BY_SQL);
}
}
String sql = InlineSQLHelperUtil.replacePermissionCheck(
sb.toString(), CommercePricingClass.class.getName(),
_FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
SQLQuery sqlQuery = session.createSynchronizedSQLQuery(sql);
sqlQuery.setFirstResult(0);
sqlQuery.setMaxResults(2);
if (getDB().isSupportsInlineDistinct()) {
sqlQuery.addEntity(
_FILTER_ENTITY_ALIAS, CommercePricingClassImpl.class);
}
else {
sqlQuery.addEntity(
_FILTER_ENTITY_TABLE, CommercePricingClassImpl.class);
}
QueryPos queryPos = QueryPos.getInstance(sqlQuery);
if (bindUuid) {
queryPos.add(uuid);
}
if (orderByComparator != null) {
for (Object orderByConditionValue :
orderByComparator.getOrderByConditionValues(
commercePricingClass)) {
queryPos.add(orderByConditionValue);
}
}
List list = sqlQuery.list();
if (list.size() == 2) {
return list.get(1);
}
else {
return null;
}
}
/**
* Removes all the commerce pricing classes where uuid = ? from the database.
*
* @param uuid the uuid
*/
@Override
public void removeByUuid(String uuid) {
for (CommercePricingClass commercePricingClass :
findByUuid(uuid, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(commercePricingClass);
}
}
/**
* Returns the number of commerce pricing classes where uuid = ?.
*
* @param uuid the uuid
* @return the number of matching commerce pricing classes
*/
@Override
public int countByUuid(String uuid) {
try (SafeCloseable safeCloseable =
ctPersistenceHelper.setCTCollectionIdWithSafeCloseable(
CommercePricingClass.class)) {
uuid = Objects.toString(uuid, "");
FinderPath finderPath = _finderPathCountByUuid;
Object[] finderArgs = new Object[] {uuid};
Long count = (Long)finderCache.getResult(
finderPath, finderArgs, this);
if (count == null) {
StringBundler sb = new StringBundler(2);
sb.append(_SQL_COUNT_COMMERCEPRICINGCLASS_WHERE);
boolean bindUuid = false;
if (uuid.isEmpty()) {
sb.append(_FINDER_COLUMN_UUID_UUID_3);
}
else {
bindUuid = true;
sb.append(_FINDER_COLUMN_UUID_UUID_2);
}
String sql = sb.toString();
Session session = null;
try {
session = openSession();
Query query = session.createQuery(sql);
QueryPos queryPos = QueryPos.getInstance(query);
if (bindUuid) {
queryPos.add(uuid);
}
count = (Long)query.uniqueResult();
finderCache.putResult(finderPath, finderArgs, count);
}
catch (Exception exception) {
throw processException(exception);
}
finally {
closeSession(session);
}
}
return count.intValue();
}
}
/**
* Returns the number of commerce pricing classes that the user has permission to view where uuid = ?.
*
* @param uuid the uuid
* @return the number of matching commerce pricing classes that the user has permission to view
*/
@Override
public int filterCountByUuid(String uuid) {
if (!InlineSQLHelperUtil.isEnabled()) {
return countByUuid(uuid);
}
uuid = Objects.toString(uuid, "");
StringBundler sb = new StringBundler(2);
sb.append(_FILTER_SQL_COUNT_COMMERCEPRICINGCLASS_WHERE);
boolean bindUuid = false;
if (uuid.isEmpty()) {
sb.append(_FINDER_COLUMN_UUID_UUID_3_SQL);
}
else {
bindUuid = true;
sb.append(_FINDER_COLUMN_UUID_UUID_2_SQL);
}
String sql = InlineSQLHelperUtil.replacePermissionCheck(
sb.toString(), CommercePricingClass.class.getName(),
_FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
Session session = null;
try {
session = openSession();
SQLQuery sqlQuery = session.createSynchronizedSQLQuery(sql);
sqlQuery.addScalar(
COUNT_COLUMN_NAME, com.liferay.portal.kernel.dao.orm.Type.LONG);
QueryPos queryPos = QueryPos.getInstance(sqlQuery);
if (bindUuid) {
queryPos.add(uuid);
}
Long count = (Long)sqlQuery.uniqueResult();
return count.intValue();
}
catch (Exception exception) {
throw processException(exception);
}
finally {
closeSession(session);
}
}
private static final String _FINDER_COLUMN_UUID_UUID_2 =
"commercePricingClass.uuid = ?";
private static final String _FINDER_COLUMN_UUID_UUID_3 =
"(commercePricingClass.uuid IS NULL OR commercePricingClass.uuid = '')";
private static final String _FINDER_COLUMN_UUID_UUID_2_SQL =
"commercePricingClass.uuid_ = ?";
private static final String _FINDER_COLUMN_UUID_UUID_3_SQL =
"(commercePricingClass.uuid_ IS NULL OR commercePricingClass.uuid_ = '')";
private FinderPath _finderPathWithPaginationFindByUuid_C;
private FinderPath _finderPathWithoutPaginationFindByUuid_C;
private FinderPath _finderPathCountByUuid_C;
/**
* Returns all the commerce pricing classes where uuid = ? and companyId = ?.
*
* @param uuid the uuid
* @param companyId the company ID
* @return the matching commerce pricing classes
*/
@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 commerce pricing classes where uuid = ? and companyId = ?.
*
*
* Useful when paginating results. Returns a maximum of end - start
instances. start
and end
are not primary keys, they are indexes in the result set. Thus, 0
refers to the first result in the set. Setting both start
and end
to QueryUtil#ALL_POS
will return the full result set. If orderByComparator
is specified, then the query will include the given ORDER BY logic. If orderByComparator
is absent, then the query will include the default ORDER BY logic from CommercePricingClassModelImpl
.
*
*
* @param uuid the uuid
* @param companyId the company ID
* @param start the lower bound of the range of commerce pricing classes
* @param end the upper bound of the range of commerce pricing classes (not inclusive)
* @return the range of matching commerce pricing classes
*/
@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 commerce pricing classes where uuid = ? and companyId = ?.
*
*
* Useful when paginating results. Returns a maximum of end - start
instances. start
and end
are not primary keys, they are indexes in the result set. Thus, 0
refers to the first result in the set. Setting both start
and end
to QueryUtil#ALL_POS
will return the full result set. If orderByComparator
is specified, then the query will include the given ORDER BY logic. If orderByComparator
is absent, then the query will include the default ORDER BY logic from CommercePricingClassModelImpl
.
*
*
* @param uuid the uuid
* @param companyId the company ID
* @param start the lower bound of the range of commerce pricing classes
* @param end the upper bound of the range of commerce pricing classes (not inclusive)
* @param orderByComparator the comparator to order the results by (optionally null
)
* @return the ordered range of matching commerce pricing classes
*/
@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 commerce pricing classes where uuid = ? and companyId = ?.
*
*
* Useful when paginating results. Returns a maximum of end - start
instances. start
and end
are not primary keys, they are indexes in the result set. Thus, 0
refers to the first result in the set. Setting both start
and end
to QueryUtil#ALL_POS
will return the full result set. If orderByComparator
is specified, then the query will include the given ORDER BY logic. If orderByComparator
is absent, then the query will include the default ORDER BY logic from CommercePricingClassModelImpl
.
*
*
* @param uuid the uuid
* @param companyId the company ID
* @param start the lower bound of the range of commerce pricing classes
* @param end the upper bound of the range of commerce pricing classes (not inclusive)
* @param orderByComparator the comparator to order the results by (optionally null
)
* @param useFinderCache whether to use the finder cache
* @return the ordered range of matching commerce pricing classes
*/
@Override
public List findByUuid_C(
String uuid, long companyId, int start, int end,
OrderByComparator orderByComparator,
boolean useFinderCache) {
try (SafeCloseable safeCloseable =
ctPersistenceHelper.setCTCollectionIdWithSafeCloseable(
CommercePricingClass.class)) {
uuid = Objects.toString(uuid, "");
FinderPath finderPath = null;
Object[] finderArgs = null;
if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
(orderByComparator == null)) {
if (useFinderCache) {
finderPath = _finderPathWithoutPaginationFindByUuid_C;
finderArgs = new Object[] {uuid, companyId};
}
}
else if (useFinderCache) {
finderPath = _finderPathWithPaginationFindByUuid_C;
finderArgs = new Object[] {
uuid, companyId, start, end, orderByComparator
};
}
List list = null;
if (useFinderCache) {
list = (List)finderCache.getResult(
finderPath, finderArgs, this);
if ((list != null) && !list.isEmpty()) {
for (CommercePricingClass commercePricingClass : list) {
if (!uuid.equals(commercePricingClass.getUuid()) ||
(companyId !=
commercePricingClass.getCompanyId())) {
list = null;
break;
}
}
}
}
if (list == null) {
StringBundler sb = null;
if (orderByComparator != null) {
sb = new StringBundler(
4 + (orderByComparator.getOrderByFields().length * 2));
}
else {
sb = new StringBundler(4);
}
sb.append(_SQL_SELECT_COMMERCEPRICINGCLASS_WHERE);
boolean bindUuid = false;
if (uuid.isEmpty()) {
sb.append(_FINDER_COLUMN_UUID_C_UUID_3);
}
else {
bindUuid = true;
sb.append(_FINDER_COLUMN_UUID_C_UUID_2);
}
sb.append(_FINDER_COLUMN_UUID_C_COMPANYID_2);
if (orderByComparator != null) {
appendOrderByComparator(
sb, _ORDER_BY_ENTITY_ALIAS, orderByComparator);
}
else {
sb.append(CommercePricingClassModelImpl.ORDER_BY_JPQL);
}
String sql = sb.toString();
Session session = null;
try {
session = openSession();
Query query = session.createQuery(sql);
QueryPos queryPos = QueryPos.getInstance(query);
if (bindUuid) {
queryPos.add(uuid);
}
queryPos.add(companyId);
list = (List)QueryUtil.list(
query, getDialect(), start, end);
cacheResult(list);
if (useFinderCache) {
finderCache.putResult(finderPath, finderArgs, list);
}
}
catch (Exception exception) {
throw processException(exception);
}
finally {
closeSession(session);
}
}
return list;
}
}
/**
* Returns the first commerce pricing class 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 commerce pricing class
* @throws NoSuchPricingClassException if a matching commerce pricing class could not be found
*/
@Override
public CommercePricingClass findByUuid_C_First(
String uuid, long companyId,
OrderByComparator orderByComparator)
throws NoSuchPricingClassException {
CommercePricingClass commercePricingClass = fetchByUuid_C_First(
uuid, companyId, orderByComparator);
if (commercePricingClass != null) {
return commercePricingClass;
}
StringBundler sb = new StringBundler(6);
sb.append(_NO_SUCH_ENTITY_WITH_KEY);
sb.append("uuid=");
sb.append(uuid);
sb.append(", companyId=");
sb.append(companyId);
sb.append("}");
throw new NoSuchPricingClassException(sb.toString());
}
/**
* Returns the first commerce pricing class 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 commerce pricing class, or null
if a matching commerce pricing class could not be found
*/
@Override
public CommercePricingClass 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 commerce pricing class 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 commerce pricing class
* @throws NoSuchPricingClassException if a matching commerce pricing class could not be found
*/
@Override
public CommercePricingClass findByUuid_C_Last(
String uuid, long companyId,
OrderByComparator orderByComparator)
throws NoSuchPricingClassException {
CommercePricingClass commercePricingClass = fetchByUuid_C_Last(
uuid, companyId, orderByComparator);
if (commercePricingClass != null) {
return commercePricingClass;
}
StringBundler sb = new StringBundler(6);
sb.append(_NO_SUCH_ENTITY_WITH_KEY);
sb.append("uuid=");
sb.append(uuid);
sb.append(", companyId=");
sb.append(companyId);
sb.append("}");
throw new NoSuchPricingClassException(sb.toString());
}
/**
* Returns the last commerce pricing class 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 commerce pricing class, or null
if a matching commerce pricing class could not be found
*/
@Override
public CommercePricingClass 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 commerce pricing classes before and after the current commerce pricing class in the ordered set where uuid = ? and companyId = ?.
*
* @param commercePricingClassId the primary key of the current commerce pricing class
* @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 commerce pricing class
* @throws NoSuchPricingClassException if a commerce pricing class with the primary key could not be found
*/
@Override
public CommercePricingClass[] findByUuid_C_PrevAndNext(
long commercePricingClassId, String uuid, long companyId,
OrderByComparator orderByComparator)
throws NoSuchPricingClassException {
uuid = Objects.toString(uuid, "");
CommercePricingClass commercePricingClass = findByPrimaryKey(
commercePricingClassId);
Session session = null;
try {
session = openSession();
CommercePricingClass[] array = new CommercePricingClassImpl[3];
array[0] = getByUuid_C_PrevAndNext(
session, commercePricingClass, uuid, companyId,
orderByComparator, true);
array[1] = commercePricingClass;
array[2] = getByUuid_C_PrevAndNext(
session, commercePricingClass, uuid, companyId,
orderByComparator, false);
return array;
}
catch (Exception exception) {
throw processException(exception);
}
finally {
closeSession(session);
}
}
protected CommercePricingClass getByUuid_C_PrevAndNext(
Session session, CommercePricingClass commercePricingClass, String uuid,
long companyId,
OrderByComparator orderByComparator,
boolean previous) {
StringBundler sb = null;
if (orderByComparator != null) {
sb = new StringBundler(
5 + (orderByComparator.getOrderByConditionFields().length * 3) +
(orderByComparator.getOrderByFields().length * 3));
}
else {
sb = new StringBundler(4);
}
sb.append(_SQL_SELECT_COMMERCEPRICINGCLASS_WHERE);
boolean bindUuid = false;
if (uuid.isEmpty()) {
sb.append(_FINDER_COLUMN_UUID_C_UUID_3);
}
else {
bindUuid = true;
sb.append(_FINDER_COLUMN_UUID_C_UUID_2);
}
sb.append(_FINDER_COLUMN_UUID_C_COMPANYID_2);
if (orderByComparator != null) {
String[] orderByConditionFields =
orderByComparator.getOrderByConditionFields();
if (orderByConditionFields.length > 0) {
sb.append(WHERE_AND);
}
for (int i = 0; i < orderByConditionFields.length; i++) {
sb.append(_ORDER_BY_ENTITY_ALIAS);
sb.append(orderByConditionFields[i]);
if ((i + 1) < orderByConditionFields.length) {
if (orderByComparator.isAscending() ^ previous) {
sb.append(WHERE_GREATER_THAN_HAS_NEXT);
}
else {
sb.append(WHERE_LESSER_THAN_HAS_NEXT);
}
}
else {
if (orderByComparator.isAscending() ^ previous) {
sb.append(WHERE_GREATER_THAN);
}
else {
sb.append(WHERE_LESSER_THAN);
}
}
}
sb.append(ORDER_BY_CLAUSE);
String[] orderByFields = orderByComparator.getOrderByFields();
for (int i = 0; i < orderByFields.length; i++) {
sb.append(_ORDER_BY_ENTITY_ALIAS);
sb.append(orderByFields[i]);
if ((i + 1) < orderByFields.length) {
if (orderByComparator.isAscending() ^ previous) {
sb.append(ORDER_BY_ASC_HAS_NEXT);
}
else {
sb.append(ORDER_BY_DESC_HAS_NEXT);
}
}
else {
if (orderByComparator.isAscending() ^ previous) {
sb.append(ORDER_BY_ASC);
}
else {
sb.append(ORDER_BY_DESC);
}
}
}
}
else {
sb.append(CommercePricingClassModelImpl.ORDER_BY_JPQL);
}
String sql = sb.toString();
Query query = session.createQuery(sql);
query.setFirstResult(0);
query.setMaxResults(2);
QueryPos queryPos = QueryPos.getInstance(query);
if (bindUuid) {
queryPos.add(uuid);
}
queryPos.add(companyId);
if (orderByComparator != null) {
for (Object orderByConditionValue :
orderByComparator.getOrderByConditionValues(
commercePricingClass)) {
queryPos.add(orderByConditionValue);
}
}
List list = query.list();
if (list.size() == 2) {
return list.get(1);
}
else {
return null;
}
}
/**
* Returns all the commerce pricing classes that the user has permission to view where uuid = ? and companyId = ?.
*
* @param uuid the uuid
* @param companyId the company ID
* @return the matching commerce pricing classes that the user has permission to view
*/
@Override
public List filterFindByUuid_C(
String uuid, long companyId) {
return filterFindByUuid_C(
uuid, companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
}
/**
* Returns a range of all the commerce pricing classes that the user has permission to view where uuid = ? and companyId = ?.
*
*
* Useful when paginating results. Returns a maximum of end - start
instances. start
and end
are not primary keys, they are indexes in the result set. Thus, 0
refers to the first result in the set. Setting both start
and end
to QueryUtil#ALL_POS
will return the full result set. If orderByComparator
is specified, then the query will include the given ORDER BY logic. If orderByComparator
is absent, then the query will include the default ORDER BY logic from CommercePricingClassModelImpl
.
*
*
* @param uuid the uuid
* @param companyId the company ID
* @param start the lower bound of the range of commerce pricing classes
* @param end the upper bound of the range of commerce pricing classes (not inclusive)
* @return the range of matching commerce pricing classes that the user has permission to view
*/
@Override
public List filterFindByUuid_C(
String uuid, long companyId, int start, int end) {
return filterFindByUuid_C(uuid, companyId, start, end, null);
}
/**
* Returns an ordered range of all the commerce pricing classes that the user has permissions to view where uuid = ? and companyId = ?.
*
*
* Useful when paginating results. Returns a maximum of end - start
instances. start
and end
are not primary keys, they are indexes in the result set. Thus, 0
refers to the first result in the set. Setting both start
and end
to QueryUtil#ALL_POS
will return the full result set. If orderByComparator
is specified, then the query will include the given ORDER BY logic. If orderByComparator
is absent, then the query will include the default ORDER BY logic from CommercePricingClassModelImpl
.
*
*
* @param uuid the uuid
* @param companyId the company ID
* @param start the lower bound of the range of commerce pricing classes
* @param end the upper bound of the range of commerce pricing classes (not inclusive)
* @param orderByComparator the comparator to order the results by (optionally null
)
* @return the ordered range of matching commerce pricing classes that the user has permission to view
*/
@Override
public List filterFindByUuid_C(
String uuid, long companyId, int start, int end,
OrderByComparator orderByComparator) {
if (!InlineSQLHelperUtil.isEnabled(companyId, 0)) {
return findByUuid_C(uuid, companyId, start, end, orderByComparator);
}
uuid = Objects.toString(uuid, "");
StringBundler sb = null;
if (orderByComparator != null) {
sb = new StringBundler(
4 + (orderByComparator.getOrderByFields().length * 2));
}
else {
sb = new StringBundler(5);
}
if (getDB().isSupportsInlineDistinct()) {
sb.append(_FILTER_SQL_SELECT_COMMERCEPRICINGCLASS_WHERE);
}
else {
sb.append(
_FILTER_SQL_SELECT_COMMERCEPRICINGCLASS_NO_INLINE_DISTINCT_WHERE_1);
}
boolean bindUuid = false;
if (uuid.isEmpty()) {
sb.append(_FINDER_COLUMN_UUID_C_UUID_3_SQL);
}
else {
bindUuid = true;
sb.append(_FINDER_COLUMN_UUID_C_UUID_2_SQL);
}
sb.append(_FINDER_COLUMN_UUID_C_COMPANYID_2);
if (!getDB().isSupportsInlineDistinct()) {
sb.append(
_FILTER_SQL_SELECT_COMMERCEPRICINGCLASS_NO_INLINE_DISTINCT_WHERE_2);
}
if (orderByComparator != null) {
if (getDB().isSupportsInlineDistinct()) {
appendOrderByComparator(
sb, _ORDER_BY_ENTITY_ALIAS, orderByComparator, true);
}
else {
appendOrderByComparator(
sb, _ORDER_BY_ENTITY_TABLE, orderByComparator, true);
}
}
else {
if (getDB().isSupportsInlineDistinct()) {
sb.append(
CommercePricingClassModelImpl.ORDER_BY_SQL_INLINE_DISTINCT);
}
else {
sb.append(CommercePricingClassModelImpl.ORDER_BY_SQL);
}
}
String sql = InlineSQLHelperUtil.replacePermissionCheck(
sb.toString(), CommercePricingClass.class.getName(),
_FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
Session session = null;
try {
session = openSession();
SQLQuery sqlQuery = session.createSynchronizedSQLQuery(sql);
if (getDB().isSupportsInlineDistinct()) {
sqlQuery.addEntity(
_FILTER_ENTITY_ALIAS, CommercePricingClassImpl.class);
}
else {
sqlQuery.addEntity(
_FILTER_ENTITY_TABLE, CommercePricingClassImpl.class);
}
QueryPos queryPos = QueryPos.getInstance(sqlQuery);
if (bindUuid) {
queryPos.add(uuid);
}
queryPos.add(companyId);
return (List)QueryUtil.list(
sqlQuery, getDialect(), start, end);
}
catch (Exception exception) {
throw processException(exception);
}
finally {
closeSession(session);
}
}
/**
* Returns the commerce pricing classes before and after the current commerce pricing class in the ordered set of commerce pricing classes that the user has permission to view where uuid = ? and companyId = ?.
*
* @param commercePricingClassId the primary key of the current commerce pricing class
* @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 commerce pricing class
* @throws NoSuchPricingClassException if a commerce pricing class with the primary key could not be found
*/
@Override
public CommercePricingClass[] filterFindByUuid_C_PrevAndNext(
long commercePricingClassId, String uuid, long companyId,
OrderByComparator orderByComparator)
throws NoSuchPricingClassException {
if (!InlineSQLHelperUtil.isEnabled(companyId, 0)) {
return findByUuid_C_PrevAndNext(
commercePricingClassId, uuid, companyId, orderByComparator);
}
uuid = Objects.toString(uuid, "");
CommercePricingClass commercePricingClass = findByPrimaryKey(
commercePricingClassId);
Session session = null;
try {
session = openSession();
CommercePricingClass[] array = new CommercePricingClassImpl[3];
array[0] = filterGetByUuid_C_PrevAndNext(
session, commercePricingClass, uuid, companyId,
orderByComparator, true);
array[1] = commercePricingClass;
array[2] = filterGetByUuid_C_PrevAndNext(
session, commercePricingClass, uuid, companyId,
orderByComparator, false);
return array;
}
catch (Exception exception) {
throw processException(exception);
}
finally {
closeSession(session);
}
}
protected CommercePricingClass filterGetByUuid_C_PrevAndNext(
Session session, CommercePricingClass commercePricingClass, String uuid,
long companyId,
OrderByComparator orderByComparator,
boolean previous) {
StringBundler sb = null;
if (orderByComparator != null) {
sb = new StringBundler(
6 + (orderByComparator.getOrderByConditionFields().length * 3) +
(orderByComparator.getOrderByFields().length * 3));
}
else {
sb = new StringBundler(5);
}
if (getDB().isSupportsInlineDistinct()) {
sb.append(_FILTER_SQL_SELECT_COMMERCEPRICINGCLASS_WHERE);
}
else {
sb.append(
_FILTER_SQL_SELECT_COMMERCEPRICINGCLASS_NO_INLINE_DISTINCT_WHERE_1);
}
boolean bindUuid = false;
if (uuid.isEmpty()) {
sb.append(_FINDER_COLUMN_UUID_C_UUID_3_SQL);
}
else {
bindUuid = true;
sb.append(_FINDER_COLUMN_UUID_C_UUID_2_SQL);
}
sb.append(_FINDER_COLUMN_UUID_C_COMPANYID_2);
if (!getDB().isSupportsInlineDistinct()) {
sb.append(
_FILTER_SQL_SELECT_COMMERCEPRICINGCLASS_NO_INLINE_DISTINCT_WHERE_2);
}
if (orderByComparator != null) {
String[] orderByConditionFields =
orderByComparator.getOrderByConditionFields();
if (orderByConditionFields.length > 0) {
sb.append(WHERE_AND);
}
for (int i = 0; i < orderByConditionFields.length; i++) {
if (getDB().isSupportsInlineDistinct()) {
sb.append(
getColumnName(
_ORDER_BY_ENTITY_ALIAS, orderByConditionFields[i],
true));
}
else {
sb.append(
getColumnName(
_ORDER_BY_ENTITY_TABLE, orderByConditionFields[i],
true));
}
if ((i + 1) < orderByConditionFields.length) {
if (orderByComparator.isAscending() ^ previous) {
sb.append(WHERE_GREATER_THAN_HAS_NEXT);
}
else {
sb.append(WHERE_LESSER_THAN_HAS_NEXT);
}
}
else {
if (orderByComparator.isAscending() ^ previous) {
sb.append(WHERE_GREATER_THAN);
}
else {
sb.append(WHERE_LESSER_THAN);
}
}
}
sb.append(ORDER_BY_CLAUSE);
String[] orderByFields = orderByComparator.getOrderByFields();
for (int i = 0; i < orderByFields.length; i++) {
if (getDB().isSupportsInlineDistinct()) {
sb.append(
getColumnName(
_ORDER_BY_ENTITY_ALIAS, orderByFields[i], true));
}
else {
sb.append(
getColumnName(
_ORDER_BY_ENTITY_TABLE, orderByFields[i], true));
}
if ((i + 1) < orderByFields.length) {
if (orderByComparator.isAscending() ^ previous) {
sb.append(ORDER_BY_ASC_HAS_NEXT);
}
else {
sb.append(ORDER_BY_DESC_HAS_NEXT);
}
}
else {
if (orderByComparator.isAscending() ^ previous) {
sb.append(ORDER_BY_ASC);
}
else {
sb.append(ORDER_BY_DESC);
}
}
}
}
else {
if (getDB().isSupportsInlineDistinct()) {
sb.append(
CommercePricingClassModelImpl.ORDER_BY_SQL_INLINE_DISTINCT);
}
else {
sb.append(CommercePricingClassModelImpl.ORDER_BY_SQL);
}
}
String sql = InlineSQLHelperUtil.replacePermissionCheck(
sb.toString(), CommercePricingClass.class.getName(),
_FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
SQLQuery sqlQuery = session.createSynchronizedSQLQuery(sql);
sqlQuery.setFirstResult(0);
sqlQuery.setMaxResults(2);
if (getDB().isSupportsInlineDistinct()) {
sqlQuery.addEntity(
_FILTER_ENTITY_ALIAS, CommercePricingClassImpl.class);
}
else {
sqlQuery.addEntity(
_FILTER_ENTITY_TABLE, CommercePricingClassImpl.class);
}
QueryPos queryPos = QueryPos.getInstance(sqlQuery);
if (bindUuid) {
queryPos.add(uuid);
}
queryPos.add(companyId);
if (orderByComparator != null) {
for (Object orderByConditionValue :
orderByComparator.getOrderByConditionValues(
commercePricingClass)) {
queryPos.add(orderByConditionValue);
}
}
List list = sqlQuery.list();
if (list.size() == 2) {
return list.get(1);
}
else {
return null;
}
}
/**
* Removes all the commerce pricing classes 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 (CommercePricingClass commercePricingClass :
findByUuid_C(
uuid, companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS,
null)) {
remove(commercePricingClass);
}
}
/**
* Returns the number of commerce pricing classes where uuid = ? and companyId = ?.
*
* @param uuid the uuid
* @param companyId the company ID
* @return the number of matching commerce pricing classes
*/
@Override
public int countByUuid_C(String uuid, long companyId) {
try (SafeCloseable safeCloseable =
ctPersistenceHelper.setCTCollectionIdWithSafeCloseable(
CommercePricingClass.class)) {
uuid = Objects.toString(uuid, "");
FinderPath finderPath = _finderPathCountByUuid_C;
Object[] finderArgs = new Object[] {uuid, companyId};
Long count = (Long)finderCache.getResult(
finderPath, finderArgs, this);
if (count == null) {
StringBundler sb = new StringBundler(3);
sb.append(_SQL_COUNT_COMMERCEPRICINGCLASS_WHERE);
boolean bindUuid = false;
if (uuid.isEmpty()) {
sb.append(_FINDER_COLUMN_UUID_C_UUID_3);
}
else {
bindUuid = true;
sb.append(_FINDER_COLUMN_UUID_C_UUID_2);
}
sb.append(_FINDER_COLUMN_UUID_C_COMPANYID_2);
String sql = sb.toString();
Session session = null;
try {
session = openSession();
Query query = session.createQuery(sql);
QueryPos queryPos = QueryPos.getInstance(query);
if (bindUuid) {
queryPos.add(uuid);
}
queryPos.add(companyId);
count = (Long)query.uniqueResult();
finderCache.putResult(finderPath, finderArgs, count);
}
catch (Exception exception) {
throw processException(exception);
}
finally {
closeSession(session);
}
}
return count.intValue();
}
}
/**
* Returns the number of commerce pricing classes that the user has permission to view where uuid = ? and companyId = ?.
*
* @param uuid the uuid
* @param companyId the company ID
* @return the number of matching commerce pricing classes that the user has permission to view
*/
@Override
public int filterCountByUuid_C(String uuid, long companyId) {
if (!InlineSQLHelperUtil.isEnabled(companyId, 0)) {
return countByUuid_C(uuid, companyId);
}
uuid = Objects.toString(uuid, "");
StringBundler sb = new StringBundler(3);
sb.append(_FILTER_SQL_COUNT_COMMERCEPRICINGCLASS_WHERE);
boolean bindUuid = false;
if (uuid.isEmpty()) {
sb.append(_FINDER_COLUMN_UUID_C_UUID_3_SQL);
}
else {
bindUuid = true;
sb.append(_FINDER_COLUMN_UUID_C_UUID_2_SQL);
}
sb.append(_FINDER_COLUMN_UUID_C_COMPANYID_2);
String sql = InlineSQLHelperUtil.replacePermissionCheck(
sb.toString(), CommercePricingClass.class.getName(),
_FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
Session session = null;
try {
session = openSession();
SQLQuery sqlQuery = session.createSynchronizedSQLQuery(sql);
sqlQuery.addScalar(
COUNT_COLUMN_NAME, com.liferay.portal.kernel.dao.orm.Type.LONG);
QueryPos queryPos = QueryPos.getInstance(sqlQuery);
if (bindUuid) {
queryPos.add(uuid);
}
queryPos.add(companyId);
Long count = (Long)sqlQuery.uniqueResult();
return count.intValue();
}
catch (Exception exception) {
throw processException(exception);
}
finally {
closeSession(session);
}
}
private static final String _FINDER_COLUMN_UUID_C_UUID_2 =
"commercePricingClass.uuid = ? AND ";
private static final String _FINDER_COLUMN_UUID_C_UUID_3 =
"(commercePricingClass.uuid IS NULL OR commercePricingClass.uuid = '') AND ";
private static final String _FINDER_COLUMN_UUID_C_UUID_2_SQL =
"commercePricingClass.uuid_ = ? AND ";
private static final String _FINDER_COLUMN_UUID_C_UUID_3_SQL =
"(commercePricingClass.uuid_ IS NULL OR commercePricingClass.uuid_ = '') AND ";
private static final String _FINDER_COLUMN_UUID_C_COMPANYID_2 =
"commercePricingClass.companyId = ?";
private FinderPath _finderPathWithPaginationFindByCompanyId;
private FinderPath _finderPathWithoutPaginationFindByCompanyId;
private FinderPath _finderPathCountByCompanyId;
/**
* Returns all the commerce pricing classes where companyId = ?.
*
* @param companyId the company ID
* @return the matching commerce pricing classes
*/
@Override
public List findByCompanyId(long companyId) {
return findByCompanyId(
companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
}
/**
* Returns a range of all the commerce pricing classes where companyId = ?.
*
*
* Useful when paginating results. Returns a maximum of end - start
instances. start
and end
are not primary keys, they are indexes in the result set. Thus, 0
refers to the first result in the set. Setting both start
and end
to QueryUtil#ALL_POS
will return the full result set. If orderByComparator
is specified, then the query will include the given ORDER BY logic. If orderByComparator
is absent, then the query will include the default ORDER BY logic from CommercePricingClassModelImpl
.
*
*
* @param companyId the company ID
* @param start the lower bound of the range of commerce pricing classes
* @param end the upper bound of the range of commerce pricing classes (not inclusive)
* @return the range of matching commerce pricing classes
*/
@Override
public List findByCompanyId(
long companyId, int start, int end) {
return findByCompanyId(companyId, start, end, null);
}
/**
* Returns an ordered range of all the commerce pricing classes where companyId = ?.
*
*
* Useful when paginating results. Returns a maximum of end - start
instances. start
and end
are not primary keys, they are indexes in the result set. Thus, 0
refers to the first result in the set. Setting both start
and end
to QueryUtil#ALL_POS
will return the full result set. If orderByComparator
is specified, then the query will include the given ORDER BY logic. If orderByComparator
is absent, then the query will include the default ORDER BY logic from CommercePricingClassModelImpl
.
*
*
* @param companyId the company ID
* @param start the lower bound of the range of commerce pricing classes
* @param end the upper bound of the range of commerce pricing classes (not inclusive)
* @param orderByComparator the comparator to order the results by (optionally null
)
* @return the ordered range of matching commerce pricing classes
*/
@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 commerce pricing classes where companyId = ?.
*
*
* Useful when paginating results. Returns a maximum of end - start
instances. start
and end
are not primary keys, they are indexes in the result set. Thus, 0
refers to the first result in the set. Setting both start
and end
to QueryUtil#ALL_POS
will return the full result set. If orderByComparator
is specified, then the query will include the given ORDER BY logic. If orderByComparator
is absent, then the query will include the default ORDER BY logic from CommercePricingClassModelImpl
.
*
*
* @param companyId the company ID
* @param start the lower bound of the range of commerce pricing classes
* @param end the upper bound of the range of commerce pricing classes (not inclusive)
* @param orderByComparator the comparator to order the results by (optionally null
)
* @param useFinderCache whether to use the finder cache
* @return the ordered range of matching commerce pricing classes
*/
@Override
public List findByCompanyId(
long companyId, int start, int end,
OrderByComparator orderByComparator,
boolean useFinderCache) {
try (SafeCloseable safeCloseable =
ctPersistenceHelper.setCTCollectionIdWithSafeCloseable(
CommercePricingClass.class)) {
FinderPath finderPath = null;
Object[] finderArgs = null;
if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
(orderByComparator == null)) {
if (useFinderCache) {
finderPath = _finderPathWithoutPaginationFindByCompanyId;
finderArgs = new Object[] {companyId};
}
}
else if (useFinderCache) {
finderPath = _finderPathWithPaginationFindByCompanyId;
finderArgs = new Object[] {
companyId, start, end, orderByComparator
};
}
List list = null;
if (useFinderCache) {
list = (List)finderCache.getResult(
finderPath, finderArgs, this);
if ((list != null) && !list.isEmpty()) {
for (CommercePricingClass commercePricingClass : list) {
if (companyId != commercePricingClass.getCompanyId()) {
list = null;
break;
}
}
}
}
if (list == null) {
StringBundler sb = null;
if (orderByComparator != null) {
sb = new StringBundler(
3 + (orderByComparator.getOrderByFields().length * 2));
}
else {
sb = new StringBundler(3);
}
sb.append(_SQL_SELECT_COMMERCEPRICINGCLASS_WHERE);
sb.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
if (orderByComparator != null) {
appendOrderByComparator(
sb, _ORDER_BY_ENTITY_ALIAS, orderByComparator);
}
else {
sb.append(CommercePricingClassModelImpl.ORDER_BY_JPQL);
}
String sql = sb.toString();
Session session = null;
try {
session = openSession();
Query query = session.createQuery(sql);
QueryPos queryPos = QueryPos.getInstance(query);
queryPos.add(companyId);
list = (List)QueryUtil.list(
query, getDialect(), start, end);
cacheResult(list);
if (useFinderCache) {
finderCache.putResult(finderPath, finderArgs, list);
}
}
catch (Exception exception) {
throw processException(exception);
}
finally {
closeSession(session);
}
}
return list;
}
}
/**
* Returns the first commerce pricing class 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 commerce pricing class
* @throws NoSuchPricingClassException if a matching commerce pricing class could not be found
*/
@Override
public CommercePricingClass findByCompanyId_First(
long companyId,
OrderByComparator orderByComparator)
throws NoSuchPricingClassException {
CommercePricingClass commercePricingClass = fetchByCompanyId_First(
companyId, orderByComparator);
if (commercePricingClass != null) {
return commercePricingClass;
}
StringBundler sb = new StringBundler(4);
sb.append(_NO_SUCH_ENTITY_WITH_KEY);
sb.append("companyId=");
sb.append(companyId);
sb.append("}");
throw new NoSuchPricingClassException(sb.toString());
}
/**
* Returns the first commerce pricing class 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 commerce pricing class, or null
if a matching commerce pricing class could not be found
*/
@Override
public CommercePricingClass 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 commerce pricing class 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 commerce pricing class
* @throws NoSuchPricingClassException if a matching commerce pricing class could not be found
*/
@Override
public CommercePricingClass findByCompanyId_Last(
long companyId,
OrderByComparator orderByComparator)
throws NoSuchPricingClassException {
CommercePricingClass commercePricingClass = fetchByCompanyId_Last(
companyId, orderByComparator);
if (commercePricingClass != null) {
return commercePricingClass;
}
StringBundler sb = new StringBundler(4);
sb.append(_NO_SUCH_ENTITY_WITH_KEY);
sb.append("companyId=");
sb.append(companyId);
sb.append("}");
throw new NoSuchPricingClassException(sb.toString());
}
/**
* Returns the last commerce pricing class 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 commerce pricing class, or null
if a matching commerce pricing class could not be found
*/
@Override
public CommercePricingClass 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 commerce pricing classes before and after the current commerce pricing class in the ordered set where companyId = ?.
*
* @param commercePricingClassId the primary key of the current commerce pricing class
* @param companyId the company ID
* @param orderByComparator the comparator to order the set by (optionally null
)
* @return the previous, current, and next commerce pricing class
* @throws NoSuchPricingClassException if a commerce pricing class with the primary key could not be found
*/
@Override
public CommercePricingClass[] findByCompanyId_PrevAndNext(
long commercePricingClassId, long companyId,
OrderByComparator orderByComparator)
throws NoSuchPricingClassException {
CommercePricingClass commercePricingClass = findByPrimaryKey(
commercePricingClassId);
Session session = null;
try {
session = openSession();
CommercePricingClass[] array = new CommercePricingClassImpl[3];
array[0] = getByCompanyId_PrevAndNext(
session, commercePricingClass, companyId, orderByComparator,
true);
array[1] = commercePricingClass;
array[2] = getByCompanyId_PrevAndNext(
session, commercePricingClass, companyId, orderByComparator,
false);
return array;
}
catch (Exception exception) {
throw processException(exception);
}
finally {
closeSession(session);
}
}
protected CommercePricingClass getByCompanyId_PrevAndNext(
Session session, CommercePricingClass commercePricingClass,
long companyId,
OrderByComparator orderByComparator,
boolean previous) {
StringBundler sb = null;
if (orderByComparator != null) {
sb = new StringBundler(
4 + (orderByComparator.getOrderByConditionFields().length * 3) +
(orderByComparator.getOrderByFields().length * 3));
}
else {
sb = new StringBundler(3);
}
sb.append(_SQL_SELECT_COMMERCEPRICINGCLASS_WHERE);
sb.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
if (orderByComparator != null) {
String[] orderByConditionFields =
orderByComparator.getOrderByConditionFields();
if (orderByConditionFields.length > 0) {
sb.append(WHERE_AND);
}
for (int i = 0; i < orderByConditionFields.length; i++) {
sb.append(_ORDER_BY_ENTITY_ALIAS);
sb.append(orderByConditionFields[i]);
if ((i + 1) < orderByConditionFields.length) {
if (orderByComparator.isAscending() ^ previous) {
sb.append(WHERE_GREATER_THAN_HAS_NEXT);
}
else {
sb.append(WHERE_LESSER_THAN_HAS_NEXT);
}
}
else {
if (orderByComparator.isAscending() ^ previous) {
sb.append(WHERE_GREATER_THAN);
}
else {
sb.append(WHERE_LESSER_THAN);
}
}
}
sb.append(ORDER_BY_CLAUSE);
String[] orderByFields = orderByComparator.getOrderByFields();
for (int i = 0; i < orderByFields.length; i++) {
sb.append(_ORDER_BY_ENTITY_ALIAS);
sb.append(orderByFields[i]);
if ((i + 1) < orderByFields.length) {
if (orderByComparator.isAscending() ^ previous) {
sb.append(ORDER_BY_ASC_HAS_NEXT);
}
else {
sb.append(ORDER_BY_DESC_HAS_NEXT);
}
}
else {
if (orderByComparator.isAscending() ^ previous) {
sb.append(ORDER_BY_ASC);
}
else {
sb.append(ORDER_BY_DESC);
}
}
}
}
else {
sb.append(CommercePricingClassModelImpl.ORDER_BY_JPQL);
}
String sql = sb.toString();
Query query = session.createQuery(sql);
query.setFirstResult(0);
query.setMaxResults(2);
QueryPos queryPos = QueryPos.getInstance(query);
queryPos.add(companyId);
if (orderByComparator != null) {
for (Object orderByConditionValue :
orderByComparator.getOrderByConditionValues(
commercePricingClass)) {
queryPos.add(orderByConditionValue);
}
}
List list = query.list();
if (list.size() == 2) {
return list.get(1);
}
else {
return null;
}
}
/**
* Returns all the commerce pricing classes that the user has permission to view where companyId = ?.
*
* @param companyId the company ID
* @return the matching commerce pricing classes that the user has permission to view
*/
@Override
public List filterFindByCompanyId(long companyId) {
return filterFindByCompanyId(
companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
}
/**
* Returns a range of all the commerce pricing classes that the user has permission to view where companyId = ?.
*
*
* Useful when paginating results. Returns a maximum of end - start
instances. start
and end
are not primary keys, they are indexes in the result set. Thus, 0
refers to the first result in the set. Setting both start
and end
to QueryUtil#ALL_POS
will return the full result set. If orderByComparator
is specified, then the query will include the given ORDER BY logic. If orderByComparator
is absent, then the query will include the default ORDER BY logic from CommercePricingClassModelImpl
.
*
*
* @param companyId the company ID
* @param start the lower bound of the range of commerce pricing classes
* @param end the upper bound of the range of commerce pricing classes (not inclusive)
* @return the range of matching commerce pricing classes that the user has permission to view
*/
@Override
public List filterFindByCompanyId(
long companyId, int start, int end) {
return filterFindByCompanyId(companyId, start, end, null);
}
/**
* Returns an ordered range of all the commerce pricing classes that the user has permissions to view where companyId = ?.
*
*
* Useful when paginating results. Returns a maximum of end - start
instances. start
and end
are not primary keys, they are indexes in the result set. Thus, 0
refers to the first result in the set. Setting both start
and end
to QueryUtil#ALL_POS
will return the full result set. If orderByComparator
is specified, then the query will include the given ORDER BY logic. If orderByComparator
is absent, then the query will include the default ORDER BY logic from CommercePricingClassModelImpl
.
*
*
* @param companyId the company ID
* @param start the lower bound of the range of commerce pricing classes
* @param end the upper bound of the range of commerce pricing classes (not inclusive)
* @param orderByComparator the comparator to order the results by (optionally null
)
* @return the ordered range of matching commerce pricing classes that the user has permission to view
*/
@Override
public List filterFindByCompanyId(
long companyId, int start, int end,
OrderByComparator orderByComparator) {
if (!InlineSQLHelperUtil.isEnabled(companyId, 0)) {
return findByCompanyId(companyId, start, end, orderByComparator);
}
StringBundler sb = null;
if (orderByComparator != null) {
sb = new StringBundler(
3 + (orderByComparator.getOrderByFields().length * 2));
}
else {
sb = new StringBundler(4);
}
if (getDB().isSupportsInlineDistinct()) {
sb.append(_FILTER_SQL_SELECT_COMMERCEPRICINGCLASS_WHERE);
}
else {
sb.append(
_FILTER_SQL_SELECT_COMMERCEPRICINGCLASS_NO_INLINE_DISTINCT_WHERE_1);
}
sb.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
if (!getDB().isSupportsInlineDistinct()) {
sb.append(
_FILTER_SQL_SELECT_COMMERCEPRICINGCLASS_NO_INLINE_DISTINCT_WHERE_2);
}
if (orderByComparator != null) {
if (getDB().isSupportsInlineDistinct()) {
appendOrderByComparator(
sb, _ORDER_BY_ENTITY_ALIAS, orderByComparator, true);
}
else {
appendOrderByComparator(
sb, _ORDER_BY_ENTITY_TABLE, orderByComparator, true);
}
}
else {
if (getDB().isSupportsInlineDistinct()) {
sb.append(
CommercePricingClassModelImpl.ORDER_BY_SQL_INLINE_DISTINCT);
}
else {
sb.append(CommercePricingClassModelImpl.ORDER_BY_SQL);
}
}
String sql = InlineSQLHelperUtil.replacePermissionCheck(
sb.toString(), CommercePricingClass.class.getName(),
_FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
Session session = null;
try {
session = openSession();
SQLQuery sqlQuery = session.createSynchronizedSQLQuery(sql);
if (getDB().isSupportsInlineDistinct()) {
sqlQuery.addEntity(
_FILTER_ENTITY_ALIAS, CommercePricingClassImpl.class);
}
else {
sqlQuery.addEntity(
_FILTER_ENTITY_TABLE, CommercePricingClassImpl.class);
}
QueryPos queryPos = QueryPos.getInstance(sqlQuery);
queryPos.add(companyId);
return (List)QueryUtil.list(
sqlQuery, getDialect(), start, end);
}
catch (Exception exception) {
throw processException(exception);
}
finally {
closeSession(session);
}
}
/**
* Returns the commerce pricing classes before and after the current commerce pricing class in the ordered set of commerce pricing classes that the user has permission to view where companyId = ?.
*
* @param commercePricingClassId the primary key of the current commerce pricing class
* @param companyId the company ID
* @param orderByComparator the comparator to order the set by (optionally null
)
* @return the previous, current, and next commerce pricing class
* @throws NoSuchPricingClassException if a commerce pricing class with the primary key could not be found
*/
@Override
public CommercePricingClass[] filterFindByCompanyId_PrevAndNext(
long commercePricingClassId, long companyId,
OrderByComparator orderByComparator)
throws NoSuchPricingClassException {
if (!InlineSQLHelperUtil.isEnabled(companyId, 0)) {
return findByCompanyId_PrevAndNext(
commercePricingClassId, companyId, orderByComparator);
}
CommercePricingClass commercePricingClass = findByPrimaryKey(
commercePricingClassId);
Session session = null;
try {
session = openSession();
CommercePricingClass[] array = new CommercePricingClassImpl[3];
array[0] = filterGetByCompanyId_PrevAndNext(
session, commercePricingClass, companyId, orderByComparator,
true);
array[1] = commercePricingClass;
array[2] = filterGetByCompanyId_PrevAndNext(
session, commercePricingClass, companyId, orderByComparator,
false);
return array;
}
catch (Exception exception) {
throw processException(exception);
}
finally {
closeSession(session);
}
}
protected CommercePricingClass filterGetByCompanyId_PrevAndNext(
Session session, CommercePricingClass commercePricingClass,
long companyId,
OrderByComparator orderByComparator,
boolean previous) {
StringBundler sb = null;
if (orderByComparator != null) {
sb = new StringBundler(
5 + (orderByComparator.getOrderByConditionFields().length * 3) +
(orderByComparator.getOrderByFields().length * 3));
}
else {
sb = new StringBundler(4);
}
if (getDB().isSupportsInlineDistinct()) {
sb.append(_FILTER_SQL_SELECT_COMMERCEPRICINGCLASS_WHERE);
}
else {
sb.append(
_FILTER_SQL_SELECT_COMMERCEPRICINGCLASS_NO_INLINE_DISTINCT_WHERE_1);
}
sb.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
if (!getDB().isSupportsInlineDistinct()) {
sb.append(
_FILTER_SQL_SELECT_COMMERCEPRICINGCLASS_NO_INLINE_DISTINCT_WHERE_2);
}
if (orderByComparator != null) {
String[] orderByConditionFields =
orderByComparator.getOrderByConditionFields();
if (orderByConditionFields.length > 0) {
sb.append(WHERE_AND);
}
for (int i = 0; i < orderByConditionFields.length; i++) {
if (getDB().isSupportsInlineDistinct()) {
sb.append(
getColumnName(
_ORDER_BY_ENTITY_ALIAS, orderByConditionFields[i],
true));
}
else {
sb.append(
getColumnName(
_ORDER_BY_ENTITY_TABLE, orderByConditionFields[i],
true));
}
if ((i + 1) < orderByConditionFields.length) {
if (orderByComparator.isAscending() ^ previous) {
sb.append(WHERE_GREATER_THAN_HAS_NEXT);
}
else {
sb.append(WHERE_LESSER_THAN_HAS_NEXT);
}
}
else {
if (orderByComparator.isAscending() ^ previous) {
sb.append(WHERE_GREATER_THAN);
}
else {
sb.append(WHERE_LESSER_THAN);
}
}
}
sb.append(ORDER_BY_CLAUSE);
String[] orderByFields = orderByComparator.getOrderByFields();
for (int i = 0; i < orderByFields.length; i++) {
if (getDB().isSupportsInlineDistinct()) {
sb.append(
getColumnName(
_ORDER_BY_ENTITY_ALIAS, orderByFields[i], true));
}
else {
sb.append(
getColumnName(
_ORDER_BY_ENTITY_TABLE, orderByFields[i], true));
}
if ((i + 1) < orderByFields.length) {
if (orderByComparator.isAscending() ^ previous) {
sb.append(ORDER_BY_ASC_HAS_NEXT);
}
else {
sb.append(ORDER_BY_DESC_HAS_NEXT);
}
}
else {
if (orderByComparator.isAscending() ^ previous) {
sb.append(ORDER_BY_ASC);
}
else {
sb.append(ORDER_BY_DESC);
}
}
}
}
else {
if (getDB().isSupportsInlineDistinct()) {
sb.append(
CommercePricingClassModelImpl.ORDER_BY_SQL_INLINE_DISTINCT);
}
else {
sb.append(CommercePricingClassModelImpl.ORDER_BY_SQL);
}
}
String sql = InlineSQLHelperUtil.replacePermissionCheck(
sb.toString(), CommercePricingClass.class.getName(),
_FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
SQLQuery sqlQuery = session.createSynchronizedSQLQuery(sql);
sqlQuery.setFirstResult(0);
sqlQuery.setMaxResults(2);
if (getDB().isSupportsInlineDistinct()) {
sqlQuery.addEntity(
_FILTER_ENTITY_ALIAS, CommercePricingClassImpl.class);
}
else {
sqlQuery.addEntity(
_FILTER_ENTITY_TABLE, CommercePricingClassImpl.class);
}
QueryPos queryPos = QueryPos.getInstance(sqlQuery);
queryPos.add(companyId);
if (orderByComparator != null) {
for (Object orderByConditionValue :
orderByComparator.getOrderByConditionValues(
commercePricingClass)) {
queryPos.add(orderByConditionValue);
}
}
List list = sqlQuery.list();
if (list.size() == 2) {
return list.get(1);
}
else {
return null;
}
}
/**
* Removes all the commerce pricing classes where companyId = ? from the database.
*
* @param companyId the company ID
*/
@Override
public void removeByCompanyId(long companyId) {
for (CommercePricingClass commercePricingClass :
findByCompanyId(
companyId, QueryUtil.ALL_POS, QueryUtil.ALL_POS, null)) {
remove(commercePricingClass);
}
}
/**
* Returns the number of commerce pricing classes where companyId = ?.
*
* @param companyId the company ID
* @return the number of matching commerce pricing classes
*/
@Override
public int countByCompanyId(long companyId) {
try (SafeCloseable safeCloseable =
ctPersistenceHelper.setCTCollectionIdWithSafeCloseable(
CommercePricingClass.class)) {
FinderPath finderPath = _finderPathCountByCompanyId;
Object[] finderArgs = new Object[] {companyId};
Long count = (Long)finderCache.getResult(
finderPath, finderArgs, this);
if (count == null) {
StringBundler sb = new StringBundler(2);
sb.append(_SQL_COUNT_COMMERCEPRICINGCLASS_WHERE);
sb.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
String sql = sb.toString();
Session session = null;
try {
session = openSession();
Query query = session.createQuery(sql);
QueryPos queryPos = QueryPos.getInstance(query);
queryPos.add(companyId);
count = (Long)query.uniqueResult();
finderCache.putResult(finderPath, finderArgs, count);
}
catch (Exception exception) {
throw processException(exception);
}
finally {
closeSession(session);
}
}
return count.intValue();
}
}
/**
* Returns the number of commerce pricing classes that the user has permission to view where companyId = ?.
*
* @param companyId the company ID
* @return the number of matching commerce pricing classes that the user has permission to view
*/
@Override
public int filterCountByCompanyId(long companyId) {
if (!InlineSQLHelperUtil.isEnabled(companyId, 0)) {
return countByCompanyId(companyId);
}
StringBundler sb = new StringBundler(2);
sb.append(_FILTER_SQL_COUNT_COMMERCEPRICINGCLASS_WHERE);
sb.append(_FINDER_COLUMN_COMPANYID_COMPANYID_2);
String sql = InlineSQLHelperUtil.replacePermissionCheck(
sb.toString(), CommercePricingClass.class.getName(),
_FILTER_ENTITY_TABLE_FILTER_PK_COLUMN);
Session session = null;
try {
session = openSession();
SQLQuery sqlQuery = session.createSynchronizedSQLQuery(sql);
sqlQuery.addScalar(
COUNT_COLUMN_NAME, com.liferay.portal.kernel.dao.orm.Type.LONG);
QueryPos queryPos = QueryPos.getInstance(sqlQuery);
queryPos.add(companyId);
Long count = (Long)sqlQuery.uniqueResult();
return count.intValue();
}
catch (Exception exception) {
throw processException(exception);
}
finally {
closeSession(session);
}
}
private static final String _FINDER_COLUMN_COMPANYID_COMPANYID_2 =
"commercePricingClass.companyId = ?";
private FinderPath _finderPathFetchByERC_C;
private FinderPath _finderPathCountByERC_C;
/**
* Returns the commerce pricing class where externalReferenceCode = ? and companyId = ? or throws a NoSuchPricingClassException
if it could not be found.
*
* @param externalReferenceCode the external reference code
* @param companyId the company ID
* @return the matching commerce pricing class
* @throws NoSuchPricingClassException if a matching commerce pricing class could not be found
*/
@Override
public CommercePricingClass findByERC_C(
String externalReferenceCode, long companyId)
throws NoSuchPricingClassException {
CommercePricingClass commercePricingClass = fetchByERC_C(
externalReferenceCode, companyId);
if (commercePricingClass == null) {
StringBundler sb = new StringBundler(6);
sb.append(_NO_SUCH_ENTITY_WITH_KEY);
sb.append("externalReferenceCode=");
sb.append(externalReferenceCode);
sb.append(", companyId=");
sb.append(companyId);
sb.append("}");
if (_log.isDebugEnabled()) {
_log.debug(sb.toString());
}
throw new NoSuchPricingClassException(sb.toString());
}
return commercePricingClass;
}
/**
* Returns the commerce pricing class where externalReferenceCode = ? and companyId = ? or returns null
if it could not be found. Uses the finder cache.
*
* @param externalReferenceCode the external reference code
* @param companyId the company ID
* @return the matching commerce pricing class, or null
if a matching commerce pricing class could not be found
*/
@Override
public CommercePricingClass fetchByERC_C(
String externalReferenceCode, long companyId) {
return fetchByERC_C(externalReferenceCode, companyId, true);
}
/**
* Returns the commerce pricing class where externalReferenceCode = ? and companyId = ? or returns null
if it could not be found, optionally using the finder cache.
*
* @param externalReferenceCode the external reference code
* @param companyId the company ID
* @param useFinderCache whether to use the finder cache
* @return the matching commerce pricing class, or null
if a matching commerce pricing class could not be found
*/
@Override
public CommercePricingClass fetchByERC_C(
String externalReferenceCode, long companyId, boolean useFinderCache) {
try (SafeCloseable safeCloseable =
ctPersistenceHelper.setCTCollectionIdWithSafeCloseable(
CommercePricingClass.class)) {
externalReferenceCode = Objects.toString(externalReferenceCode, "");
Object[] finderArgs = null;
if (useFinderCache) {
finderArgs = new Object[] {externalReferenceCode, companyId};
}
Object result = null;
if (useFinderCache) {
result = finderCache.getResult(
_finderPathFetchByERC_C, finderArgs, this);
}
if (result instanceof CommercePricingClass) {
CommercePricingClass commercePricingClass =
(CommercePricingClass)result;
if (!Objects.equals(
externalReferenceCode,
commercePricingClass.getExternalReferenceCode()) ||
(companyId != commercePricingClass.getCompanyId())) {
result = null;
}
}
if (result == null) {
StringBundler sb = new StringBundler(4);
sb.append(_SQL_SELECT_COMMERCEPRICINGCLASS_WHERE);
boolean bindExternalReferenceCode = false;
if (externalReferenceCode.isEmpty()) {
sb.append(_FINDER_COLUMN_ERC_C_EXTERNALREFERENCECODE_3);
}
else {
bindExternalReferenceCode = true;
sb.append(_FINDER_COLUMN_ERC_C_EXTERNALREFERENCECODE_2);
}
sb.append(_FINDER_COLUMN_ERC_C_COMPANYID_2);
String sql = sb.toString();
Session session = null;
try {
session = openSession();
Query query = session.createQuery(sql);
QueryPos queryPos = QueryPos.getInstance(query);
if (bindExternalReferenceCode) {
queryPos.add(externalReferenceCode);
}
queryPos.add(companyId);
List list = query.list();
if (list.isEmpty()) {
if (useFinderCache) {
finderCache.putResult(
_finderPathFetchByERC_C, finderArgs, list);
}
}
else {
CommercePricingClass commercePricingClass = list.get(0);
result = commercePricingClass;
cacheResult(commercePricingClass);
}
}
catch (Exception exception) {
throw processException(exception);
}
finally {
closeSession(session);
}
}
if (result instanceof List>) {
return null;
}
else {
return (CommercePricingClass)result;
}
}
}
/**
* Removes the commerce pricing class where externalReferenceCode = ? and companyId = ? from the database.
*
* @param externalReferenceCode the external reference code
* @param companyId the company ID
* @return the commerce pricing class that was removed
*/
@Override
public CommercePricingClass removeByERC_C(
String externalReferenceCode, long companyId)
throws NoSuchPricingClassException {
CommercePricingClass commercePricingClass = findByERC_C(
externalReferenceCode, companyId);
return remove(commercePricingClass);
}
/**
* Returns the number of commerce pricing classes where externalReferenceCode = ? and companyId = ?.
*
* @param externalReferenceCode the external reference code
* @param companyId the company ID
* @return the number of matching commerce pricing classes
*/
@Override
public int countByERC_C(String externalReferenceCode, long companyId) {
try (SafeCloseable safeCloseable =
ctPersistenceHelper.setCTCollectionIdWithSafeCloseable(
CommercePricingClass.class)) {
externalReferenceCode = Objects.toString(externalReferenceCode, "");
FinderPath finderPath = _finderPathCountByERC_C;
Object[] finderArgs = new Object[] {
externalReferenceCode, companyId
};
Long count = (Long)finderCache.getResult(
finderPath, finderArgs, this);
if (count == null) {
StringBundler sb = new StringBundler(3);
sb.append(_SQL_COUNT_COMMERCEPRICINGCLASS_WHERE);
boolean bindExternalReferenceCode = false;
if (externalReferenceCode.isEmpty()) {
sb.append(_FINDER_COLUMN_ERC_C_EXTERNALREFERENCECODE_3);
}
else {
bindExternalReferenceCode = true;
sb.append(_FINDER_COLUMN_ERC_C_EXTERNALREFERENCECODE_2);
}
sb.append(_FINDER_COLUMN_ERC_C_COMPANYID_2);
String sql = sb.toString();
Session session = null;
try {
session = openSession();
Query query = session.createQuery(sql);
QueryPos queryPos = QueryPos.getInstance(query);
if (bindExternalReferenceCode) {
queryPos.add(externalReferenceCode);
}
queryPos.add(companyId);
count = (Long)query.uniqueResult();
finderCache.putResult(finderPath, finderArgs, count);
}
catch (Exception exception) {
throw processException(exception);
}
finally {
closeSession(session);
}
}
return count.intValue();
}
}
private static final String _FINDER_COLUMN_ERC_C_EXTERNALREFERENCECODE_2 =
"commercePricingClass.externalReferenceCode = ? AND ";
private static final String _FINDER_COLUMN_ERC_C_EXTERNALREFERENCECODE_3 =
"(commercePricingClass.externalReferenceCode IS NULL OR commercePricingClass.externalReferenceCode = '') AND ";
private static final String _FINDER_COLUMN_ERC_C_COMPANYID_2 =
"commercePricingClass.companyId = ?";
public CommercePricingClassPersistenceImpl() {
Map dbColumnNames = new HashMap();
dbColumnNames.put("uuid", "uuid_");
setDBColumnNames(dbColumnNames);
setModelClass(CommercePricingClass.class);
setModelImplClass(CommercePricingClassImpl.class);
setModelPKClass(long.class);
setTable(CommercePricingClassTable.INSTANCE);
}
/**
* Caches the commerce pricing class in the entity cache if it is enabled.
*
* @param commercePricingClass the commerce pricing class
*/
@Override
public void cacheResult(CommercePricingClass commercePricingClass) {
try (SafeCloseable safeCloseable =
CTCollectionThreadLocal.setCTCollectionIdWithSafeCloseable(
commercePricingClass.getCtCollectionId())) {
entityCache.putResult(
CommercePricingClassImpl.class,
commercePricingClass.getPrimaryKey(), commercePricingClass);
finderCache.putResult(
_finderPathFetchByERC_C,
new Object[] {
commercePricingClass.getExternalReferenceCode(),
commercePricingClass.getCompanyId()
},
commercePricingClass);
}
}
private int _valueObjectFinderCacheListThreshold;
/**
* Caches the commerce pricing classes in the entity cache if it is enabled.
*
* @param commercePricingClasses the commerce pricing classes
*/
@Override
public void cacheResult(List commercePricingClasses) {
if ((_valueObjectFinderCacheListThreshold == 0) ||
((_valueObjectFinderCacheListThreshold > 0) &&
(commercePricingClasses.size() >
_valueObjectFinderCacheListThreshold))) {
return;
}
for (CommercePricingClass commercePricingClass :
commercePricingClasses) {
try (SafeCloseable safeCloseable =
CTCollectionThreadLocal.setCTCollectionIdWithSafeCloseable(
commercePricingClass.getCtCollectionId())) {
if (entityCache.getResult(
CommercePricingClassImpl.class,
commercePricingClass.getPrimaryKey()) == null) {
cacheResult(commercePricingClass);
}
}
}
}
/**
* Clears the cache for all commerce pricing classes.
*
*
* The EntityCache
and FinderCache
are both cleared by this method.
*
*/
@Override
public void clearCache() {
entityCache.clearCache(CommercePricingClassImpl.class);
finderCache.clearCache(CommercePricingClassImpl.class);
}
/**
* Clears the cache for the commerce pricing class.
*
*
* The EntityCache
and FinderCache
are both cleared by this method.
*
*/
@Override
public void clearCache(CommercePricingClass commercePricingClass) {
entityCache.removeResult(
CommercePricingClassImpl.class, commercePricingClass);
}
@Override
public void clearCache(List commercePricingClasses) {
for (CommercePricingClass commercePricingClass :
commercePricingClasses) {
entityCache.removeResult(
CommercePricingClassImpl.class, commercePricingClass);
}
}
@Override
public void clearCache(Set primaryKeys) {
finderCache.clearCache(CommercePricingClassImpl.class);
for (Serializable primaryKey : primaryKeys) {
entityCache.removeResult(
CommercePricingClassImpl.class, primaryKey);
}
}
protected void cacheUniqueFindersCache(
CommercePricingClassModelImpl commercePricingClassModelImpl) {
try (SafeCloseable safeCloseable =
CTCollectionThreadLocal.setCTCollectionIdWithSafeCloseable(
commercePricingClassModelImpl.getCtCollectionId())) {
Object[] args = new Object[] {
commercePricingClassModelImpl.getExternalReferenceCode(),
commercePricingClassModelImpl.getCompanyId()
};
finderCache.putResult(
_finderPathCountByERC_C, args, Long.valueOf(1));
finderCache.putResult(
_finderPathFetchByERC_C, args, commercePricingClassModelImpl);
}
}
/**
* Creates a new commerce pricing class with the primary key. Does not add the commerce pricing class to the database.
*
* @param commercePricingClassId the primary key for the new commerce pricing class
* @return the new commerce pricing class
*/
@Override
public CommercePricingClass create(long commercePricingClassId) {
CommercePricingClass commercePricingClass =
new CommercePricingClassImpl();
commercePricingClass.setNew(true);
commercePricingClass.setPrimaryKey(commercePricingClassId);
String uuid = PortalUUIDUtil.generate();
commercePricingClass.setUuid(uuid);
commercePricingClass.setCompanyId(CompanyThreadLocal.getCompanyId());
return commercePricingClass;
}
/**
* Removes the commerce pricing class with the primary key from the database. Also notifies the appropriate model listeners.
*
* @param commercePricingClassId the primary key of the commerce pricing class
* @return the commerce pricing class that was removed
* @throws NoSuchPricingClassException if a commerce pricing class with the primary key could not be found
*/
@Override
public CommercePricingClass remove(long commercePricingClassId)
throws NoSuchPricingClassException {
return remove((Serializable)commercePricingClassId);
}
/**
* Removes the commerce pricing class with the primary key from the database. Also notifies the appropriate model listeners.
*
* @param primaryKey the primary key of the commerce pricing class
* @return the commerce pricing class that was removed
* @throws NoSuchPricingClassException if a commerce pricing class with the primary key could not be found
*/
@Override
public CommercePricingClass remove(Serializable primaryKey)
throws NoSuchPricingClassException {
Session session = null;
try {
session = openSession();
CommercePricingClass commercePricingClass =
(CommercePricingClass)session.get(
CommercePricingClassImpl.class, primaryKey);
if (commercePricingClass == null) {
if (_log.isDebugEnabled()) {
_log.debug(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
}
throw new NoSuchPricingClassException(
_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
}
return remove(commercePricingClass);
}
catch (NoSuchPricingClassException noSuchEntityException) {
throw noSuchEntityException;
}
catch (Exception exception) {
throw processException(exception);
}
finally {
closeSession(session);
}
}
@Override
protected CommercePricingClass removeImpl(
CommercePricingClass commercePricingClass) {
Session session = null;
try {
session = openSession();
if (!session.contains(commercePricingClass)) {
commercePricingClass = (CommercePricingClass)session.get(
CommercePricingClassImpl.class,
commercePricingClass.getPrimaryKeyObj());
}
if ((commercePricingClass != null) &&
ctPersistenceHelper.isRemove(commercePricingClass)) {
session.delete(commercePricingClass);
}
}
catch (Exception exception) {
throw processException(exception);
}
finally {
closeSession(session);
}
if (commercePricingClass != null) {
clearCache(commercePricingClass);
}
return commercePricingClass;
}
@Override
public CommercePricingClass updateImpl(
CommercePricingClass commercePricingClass) {
boolean isNew = commercePricingClass.isNew();
if (!(commercePricingClass instanceof CommercePricingClassModelImpl)) {
InvocationHandler invocationHandler = null;
if (ProxyUtil.isProxyClass(commercePricingClass.getClass())) {
invocationHandler = ProxyUtil.getInvocationHandler(
commercePricingClass);
throw new IllegalArgumentException(
"Implement ModelWrapper in commercePricingClass proxy " +
invocationHandler.getClass());
}
throw new IllegalArgumentException(
"Implement ModelWrapper in custom CommercePricingClass implementation " +
commercePricingClass.getClass());
}
CommercePricingClassModelImpl commercePricingClassModelImpl =
(CommercePricingClassModelImpl)commercePricingClass;
if (Validator.isNull(commercePricingClass.getUuid())) {
String uuid = PortalUUIDUtil.generate();
commercePricingClass.setUuid(uuid);
}
if (Validator.isNull(commercePricingClass.getExternalReferenceCode())) {
commercePricingClass.setExternalReferenceCode(
commercePricingClass.getUuid());
}
else {
if (!Objects.equals(
commercePricingClassModelImpl.getColumnOriginalValue(
"externalReferenceCode"),
commercePricingClass.getExternalReferenceCode())) {
long userId = GetterUtil.getLong(
PrincipalThreadLocal.getName());
if (userId > 0) {
long companyId = commercePricingClass.getCompanyId();
long groupId = 0;
long classPK = 0;
if (!isNew) {
classPK = commercePricingClass.getPrimaryKey();
}
try {
commercePricingClass.setExternalReferenceCode(
SanitizerUtil.sanitize(
companyId, groupId, userId,
CommercePricingClass.class.getName(), classPK,
ContentTypes.TEXT_HTML, Sanitizer.MODE_ALL,
commercePricingClass.getExternalReferenceCode(),
null));
}
catch (SanitizerException sanitizerException) {
throw new SystemException(sanitizerException);
}
}
}
CommercePricingClass ercCommercePricingClass = fetchByERC_C(
commercePricingClass.getExternalReferenceCode(),
commercePricingClass.getCompanyId());
if (isNew) {
if (ercCommercePricingClass != null) {
throw new DuplicateCommercePricingClassExternalReferenceCodeException(
"Duplicate commerce pricing class with external reference code " +
commercePricingClass.getExternalReferenceCode() +
" and company " +
commercePricingClass.getCompanyId());
}
}
else {
if ((ercCommercePricingClass != null) &&
(commercePricingClass.getCommercePricingClassId() !=
ercCommercePricingClass.getCommercePricingClassId())) {
throw new DuplicateCommercePricingClassExternalReferenceCodeException(
"Duplicate commerce pricing class with external reference code " +
commercePricingClass.getExternalReferenceCode() +
" and company " +
commercePricingClass.getCompanyId());
}
}
}
ServiceContext serviceContext =
ServiceContextThreadLocal.getServiceContext();
Date date = new Date();
if (isNew && (commercePricingClass.getCreateDate() == null)) {
if (serviceContext == null) {
commercePricingClass.setCreateDate(date);
}
else {
commercePricingClass.setCreateDate(
serviceContext.getCreateDate(date));
}
}
if (!commercePricingClassModelImpl.hasSetModifiedDate()) {
if (serviceContext == null) {
commercePricingClass.setModifiedDate(date);
}
else {
commercePricingClass.setModifiedDate(
serviceContext.getModifiedDate(date));
}
}
Session session = null;
try {
session = openSession();
if (ctPersistenceHelper.isInsert(commercePricingClass)) {
if (!isNew) {
session.evict(
CommercePricingClassImpl.class,
commercePricingClass.getPrimaryKeyObj());
}
session.save(commercePricingClass);
}
else {
commercePricingClass = (CommercePricingClass)session.merge(
commercePricingClass);
}
}
catch (Exception exception) {
throw processException(exception);
}
finally {
closeSession(session);
}
entityCache.putResult(
CommercePricingClassImpl.class, commercePricingClassModelImpl,
false, true);
cacheUniqueFindersCache(commercePricingClassModelImpl);
if (isNew) {
commercePricingClass.setNew(false);
}
commercePricingClass.resetOriginalValues();
return commercePricingClass;
}
/**
* Returns the commerce pricing class 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 commerce pricing class
* @return the commerce pricing class
* @throws NoSuchPricingClassException if a commerce pricing class with the primary key could not be found
*/
@Override
public CommercePricingClass findByPrimaryKey(Serializable primaryKey)
throws NoSuchPricingClassException {
CommercePricingClass commercePricingClass = fetchByPrimaryKey(
primaryKey);
if (commercePricingClass == null) {
if (_log.isDebugEnabled()) {
_log.debug(_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
}
throw new NoSuchPricingClassException(
_NO_SUCH_ENTITY_WITH_PRIMARY_KEY + primaryKey);
}
return commercePricingClass;
}
/**
* Returns the commerce pricing class with the primary key or throws a NoSuchPricingClassException
if it could not be found.
*
* @param commercePricingClassId the primary key of the commerce pricing class
* @return the commerce pricing class
* @throws NoSuchPricingClassException if a commerce pricing class with the primary key could not be found
*/
@Override
public CommercePricingClass findByPrimaryKey(long commercePricingClassId)
throws NoSuchPricingClassException {
return findByPrimaryKey((Serializable)commercePricingClassId);
}
/**
* Returns the commerce pricing class with the primary key or returns null
if it could not be found.
*
* @param primaryKey the primary key of the commerce pricing class
* @return the commerce pricing class, or null
if a commerce pricing class with the primary key could not be found
*/
@Override
public CommercePricingClass fetchByPrimaryKey(Serializable primaryKey) {
if (ctPersistenceHelper.isProductionMode(
CommercePricingClass.class, primaryKey)) {
try (SafeCloseable safeCloseable =
CTCollectionThreadLocal.
setProductionModeWithSafeCloseable()) {
return super.fetchByPrimaryKey(primaryKey);
}
}
CommercePricingClass commercePricingClass =
(CommercePricingClass)entityCache.getResult(
CommercePricingClassImpl.class, primaryKey);
if (commercePricingClass != null) {
return commercePricingClass;
}
Session session = null;
try {
session = openSession();
commercePricingClass = (CommercePricingClass)session.get(
CommercePricingClassImpl.class, primaryKey);
if (commercePricingClass != null) {
cacheResult(commercePricingClass);
}
}
catch (Exception exception) {
throw processException(exception);
}
finally {
closeSession(session);
}
return commercePricingClass;
}
/**
* Returns the commerce pricing class with the primary key or returns null
if it could not be found.
*
* @param commercePricingClassId the primary key of the commerce pricing class
* @return the commerce pricing class, or null
if a commerce pricing class with the primary key could not be found
*/
@Override
public CommercePricingClass fetchByPrimaryKey(long commercePricingClassId) {
return fetchByPrimaryKey((Serializable)commercePricingClassId);
}
@Override
public Map fetchByPrimaryKeys(
Set primaryKeys) {
if (ctPersistenceHelper.isProductionMode(CommercePricingClass.class)) {
try (SafeCloseable safeCloseable =
CTCollectionThreadLocal.
setProductionModeWithSafeCloseable()) {
return super.fetchByPrimaryKeys(primaryKeys);
}
}
if (primaryKeys.isEmpty()) {
return Collections.emptyMap();
}
Map map =
new HashMap();
if (primaryKeys.size() == 1) {
Iterator iterator = primaryKeys.iterator();
Serializable primaryKey = iterator.next();
CommercePricingClass commercePricingClass = fetchByPrimaryKey(
primaryKey);
if (commercePricingClass != null) {
map.put(primaryKey, commercePricingClass);
}
return map;
}
Set uncachedPrimaryKeys = null;
for (Serializable primaryKey : primaryKeys) {
try (SafeCloseable safeCloseable =
ctPersistenceHelper.setCTCollectionIdWithSafeCloseable(
CommercePricingClass.class, primaryKey)) {
CommercePricingClass commercePricingClass =
(CommercePricingClass)entityCache.getResult(
CommercePricingClassImpl.class, primaryKey);
if (commercePricingClass == null) {
if (uncachedPrimaryKeys == null) {
uncachedPrimaryKeys = new HashSet<>();
}
uncachedPrimaryKeys.add(primaryKey);
}
else {
map.put(primaryKey, commercePricingClass);
}
}
}
if (uncachedPrimaryKeys == null) {
return map;
}
if ((databaseInMaxParameters > 0) &&
(primaryKeys.size() > databaseInMaxParameters)) {
Iterator iterator = primaryKeys.iterator();
while (iterator.hasNext()) {
Set page = new HashSet<>();
for (int i = 0;
(i < databaseInMaxParameters) && iterator.hasNext(); i++) {
page.add(iterator.next());
}
map.putAll(fetchByPrimaryKeys(page));
}
return map;
}
StringBundler sb = new StringBundler((primaryKeys.size() * 2) + 1);
sb.append(getSelectSQL());
sb.append(" WHERE ");
sb.append(getPKDBName());
sb.append(" IN (");
for (Serializable primaryKey : primaryKeys) {
sb.append((long)primaryKey);
sb.append(",");
}
sb.setIndex(sb.index() - 1);
sb.append(")");
String sql = sb.toString();
Session session = null;
try {
session = openSession();
Query query = session.createQuery(sql);
for (CommercePricingClass commercePricingClass :
(List)query.list()) {
map.put(
commercePricingClass.getPrimaryKeyObj(),
commercePricingClass);
cacheResult(commercePricingClass);
}
}
catch (Exception exception) {
throw processException(exception);
}
finally {
closeSession(session);
}
return map;
}
/**
* Returns all the commerce pricing classes.
*
* @return the commerce pricing classes
*/
@Override
public List findAll() {
return findAll(QueryUtil.ALL_POS, QueryUtil.ALL_POS, null);
}
/**
* Returns a range of all the commerce pricing classes.
*
*
* Useful when paginating results. Returns a maximum of end - start
instances. start
and end
are not primary keys, they are indexes in the result set. Thus, 0
refers to the first result in the set. Setting both start
and end
to QueryUtil#ALL_POS
will return the full result set. If orderByComparator
is specified, then the query will include the given ORDER BY logic. If orderByComparator
is absent, then the query will include the default ORDER BY logic from CommercePricingClassModelImpl
.
*
*
* @param start the lower bound of the range of commerce pricing classes
* @param end the upper bound of the range of commerce pricing classes (not inclusive)
* @return the range of commerce pricing classes
*/
@Override
public List findAll(int start, int end) {
return findAll(start, end, null);
}
/**
* Returns an ordered range of all the commerce pricing classes.
*
*
* Useful when paginating results. Returns a maximum of end - start
instances. start
and end
are not primary keys, they are indexes in the result set. Thus, 0
refers to the first result in the set. Setting both start
and end
to QueryUtil#ALL_POS
will return the full result set. If orderByComparator
is specified, then the query will include the given ORDER BY logic. If orderByComparator
is absent, then the query will include the default ORDER BY logic from CommercePricingClassModelImpl
.
*
*
* @param start the lower bound of the range of commerce pricing classes
* @param end the upper bound of the range of commerce pricing classes (not inclusive)
* @param orderByComparator the comparator to order the results by (optionally null
)
* @return the ordered range of commerce pricing classes
*/
@Override
public List findAll(
int start, int end,
OrderByComparator orderByComparator) {
return findAll(start, end, orderByComparator, true);
}
/**
* Returns an ordered range of all the commerce pricing classes.
*
*
* Useful when paginating results. Returns a maximum of end - start
instances. start
and end
are not primary keys, they are indexes in the result set. Thus, 0
refers to the first result in the set. Setting both start
and end
to QueryUtil#ALL_POS
will return the full result set. If orderByComparator
is specified, then the query will include the given ORDER BY logic. If orderByComparator
is absent, then the query will include the default ORDER BY logic from CommercePricingClassModelImpl
.
*
*
* @param start the lower bound of the range of commerce pricing classes
* @param end the upper bound of the range of commerce pricing classes (not inclusive)
* @param orderByComparator the comparator to order the results by (optionally null
)
* @param useFinderCache whether to use the finder cache
* @return the ordered range of commerce pricing classes
*/
@Override
public List findAll(
int start, int end,
OrderByComparator orderByComparator,
boolean useFinderCache) {
try (SafeCloseable safeCloseable =
ctPersistenceHelper.setCTCollectionIdWithSafeCloseable(
CommercePricingClass.class)) {
FinderPath finderPath = null;
Object[] finderArgs = null;
if ((start == QueryUtil.ALL_POS) && (end == QueryUtil.ALL_POS) &&
(orderByComparator == null)) {
if (useFinderCache) {
finderPath = _finderPathWithoutPaginationFindAll;
finderArgs = FINDER_ARGS_EMPTY;
}
}
else if (useFinderCache) {
finderPath = _finderPathWithPaginationFindAll;
finderArgs = new Object[] {start, end, orderByComparator};
}
List list = null;
if (useFinderCache) {
list = (List)finderCache.getResult(
finderPath, finderArgs, this);
}
if (list == null) {
StringBundler sb = null;
String sql = null;
if (orderByComparator != null) {
sb = new StringBundler(
2 + (orderByComparator.getOrderByFields().length * 2));
sb.append(_SQL_SELECT_COMMERCEPRICINGCLASS);
appendOrderByComparator(
sb, _ORDER_BY_ENTITY_ALIAS, orderByComparator);
sql = sb.toString();
}
else {
sql = _SQL_SELECT_COMMERCEPRICINGCLASS;
sql = sql.concat(
CommercePricingClassModelImpl.ORDER_BY_JPQL);
}
Session session = null;
try {
session = openSession();
Query query = session.createQuery(sql);
list = (List)QueryUtil.list(
query, getDialect(), start, end);
cacheResult(list);
if (useFinderCache) {
finderCache.putResult(finderPath, finderArgs, list);
}
}
catch (Exception exception) {
throw processException(exception);
}
finally {
closeSession(session);
}
}
return list;
}
}
/**
* Removes all the commerce pricing classes from the database.
*
*/
@Override
public void removeAll() {
for (CommercePricingClass commercePricingClass : findAll()) {
remove(commercePricingClass);
}
}
/**
* Returns the number of commerce pricing classes.
*
* @return the number of commerce pricing classes
*/
@Override
public int countAll() {
try (SafeCloseable safeCloseable =
ctPersistenceHelper.setCTCollectionIdWithSafeCloseable(
CommercePricingClass.class)) {
Long count = (Long)finderCache.getResult(
_finderPathCountAll, FINDER_ARGS_EMPTY, this);
if (count == null) {
Session session = null;
try {
session = openSession();
Query query = session.createQuery(
_SQL_COUNT_COMMERCEPRICINGCLASS);
count = (Long)query.uniqueResult();
finderCache.putResult(
_finderPathCountAll, FINDER_ARGS_EMPTY, count);
}
catch (Exception exception) {
throw processException(exception);
}
finally {
closeSession(session);
}
}
return count.intValue();
}
}
@Override
public Set getBadColumnNames() {
return _badColumnNames;
}
@Override
protected EntityCache getEntityCache() {
return entityCache;
}
@Override
protected String getPKDBName() {
return "commercePricingClassId";
}
@Override
protected String getSelectSQL() {
return _SQL_SELECT_COMMERCEPRICINGCLASS;
}
@Override
public Set getCTColumnNames(
CTColumnResolutionType ctColumnResolutionType) {
return _ctColumnNamesMap.getOrDefault(
ctColumnResolutionType, Collections.emptySet());
}
@Override
public List getMappingTableNames() {
return _mappingTableNames;
}
@Override
public Map getTableColumnsMap() {
return CommercePricingClassModelImpl.TABLE_COLUMNS_MAP;
}
@Override
public String getTableName() {
return "CommercePricingClass";
}
@Override
public List getUniqueIndexColumnNames() {
return _uniqueIndexColumnNames;
}
private static final Map>
_ctColumnNamesMap = new EnumMap>(
CTColumnResolutionType.class);
private static final List _mappingTableNames =
new ArrayList();
private static final List _uniqueIndexColumnNames =
new ArrayList();
static {
Set ctControlColumnNames = new HashSet();
Set ctIgnoreColumnNames = new HashSet();
Set ctStrictColumnNames = new HashSet();
ctControlColumnNames.add("mvccVersion");
ctControlColumnNames.add("ctCollectionId");
ctStrictColumnNames.add("uuid_");
ctStrictColumnNames.add("externalReferenceCode");
ctStrictColumnNames.add("companyId");
ctStrictColumnNames.add("userId");
ctStrictColumnNames.add("userName");
ctStrictColumnNames.add("createDate");
ctIgnoreColumnNames.add("modifiedDate");
ctStrictColumnNames.add("title");
ctStrictColumnNames.add("description");
ctStrictColumnNames.add("lastPublishDate");
_ctColumnNamesMap.put(
CTColumnResolutionType.CONTROL, ctControlColumnNames);
_ctColumnNamesMap.put(
CTColumnResolutionType.IGNORE, ctIgnoreColumnNames);
_ctColumnNamesMap.put(
CTColumnResolutionType.PK,
Collections.singleton("commercePricingClassId"));
_ctColumnNamesMap.put(
CTColumnResolutionType.STRICT, ctStrictColumnNames);
_uniqueIndexColumnNames.add(
new String[] {"externalReferenceCode", "companyId"});
}
/**
* Initializes the commerce pricing class persistence.
*/
@Activate
public void activate() {
_valueObjectFinderCacheListThreshold = GetterUtil.getInteger(
PropsUtil.get(PropsKeys.VALUE_OBJECT_FINDER_CACHE_LIST_THRESHOLD));
_finderPathWithPaginationFindAll = new FinderPath(
FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findAll", new String[0],
new String[0], true);
_finderPathWithoutPaginationFindAll = new FinderPath(
FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findAll", new String[0],
new String[0], true);
_finderPathCountAll = new FinderPath(
FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countAll",
new String[0], new String[0], false);
_finderPathWithPaginationFindByUuid = new FinderPath(
FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByUuid",
new String[] {
String.class.getName(), Integer.class.getName(),
Integer.class.getName(), OrderByComparator.class.getName()
},
new String[] {"uuid_"}, true);
_finderPathWithoutPaginationFindByUuid = new FinderPath(
FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByUuid",
new String[] {String.class.getName()}, new String[] {"uuid_"},
true);
_finderPathCountByUuid = new FinderPath(
FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUuid",
new String[] {String.class.getName()}, new String[] {"uuid_"},
false);
_finderPathWithPaginationFindByUuid_C = new FinderPath(
FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByUuid_C",
new String[] {
String.class.getName(), Long.class.getName(),
Integer.class.getName(), Integer.class.getName(),
OrderByComparator.class.getName()
},
new String[] {"uuid_", "companyId"}, true);
_finderPathWithoutPaginationFindByUuid_C = new FinderPath(
FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByUuid_C",
new String[] {String.class.getName(), Long.class.getName()},
new String[] {"uuid_", "companyId"}, true);
_finderPathCountByUuid_C = new FinderPath(
FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByUuid_C",
new String[] {String.class.getName(), Long.class.getName()},
new String[] {"uuid_", "companyId"}, false);
_finderPathWithPaginationFindByCompanyId = new FinderPath(
FINDER_CLASS_NAME_LIST_WITH_PAGINATION, "findByCompanyId",
new String[] {
Long.class.getName(), Integer.class.getName(),
Integer.class.getName(), OrderByComparator.class.getName()
},
new String[] {"companyId"}, true);
_finderPathWithoutPaginationFindByCompanyId = new FinderPath(
FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "findByCompanyId",
new String[] {Long.class.getName()}, new String[] {"companyId"},
true);
_finderPathCountByCompanyId = new FinderPath(
FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByCompanyId",
new String[] {Long.class.getName()}, new String[] {"companyId"},
false);
_finderPathFetchByERC_C = new FinderPath(
FINDER_CLASS_NAME_ENTITY, "fetchByERC_C",
new String[] {String.class.getName(), Long.class.getName()},
new String[] {"externalReferenceCode", "companyId"}, true);
_finderPathCountByERC_C = new FinderPath(
FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION, "countByERC_C",
new String[] {String.class.getName(), Long.class.getName()},
new String[] {"externalReferenceCode", "companyId"}, false);
CommercePricingClassUtil.setPersistence(this);
}
@Deactivate
public void deactivate() {
CommercePricingClassUtil.setPersistence(null);
entityCache.removeCache(CommercePricingClassImpl.class.getName());
}
@Override
@Reference(
target = CommercePersistenceConstants.SERVICE_CONFIGURATION_FILTER,
unbind = "-"
)
public void setConfiguration(Configuration configuration) {
}
@Override
@Reference(
target = CommercePersistenceConstants.ORIGIN_BUNDLE_SYMBOLIC_NAME_FILTER,
unbind = "-"
)
public void setDataSource(DataSource dataSource) {
super.setDataSource(dataSource);
}
@Override
@Reference(
target = CommercePersistenceConstants.ORIGIN_BUNDLE_SYMBOLIC_NAME_FILTER,
unbind = "-"
)
public void setSessionFactory(SessionFactory sessionFactory) {
super.setSessionFactory(sessionFactory);
}
@Reference
protected CTPersistenceHelper ctPersistenceHelper;
@Reference
protected EntityCache entityCache;
@Reference
protected FinderCache finderCache;
private static final String _SQL_SELECT_COMMERCEPRICINGCLASS =
"SELECT commercePricingClass FROM CommercePricingClass commercePricingClass";
private static final String _SQL_SELECT_COMMERCEPRICINGCLASS_WHERE =
"SELECT commercePricingClass FROM CommercePricingClass commercePricingClass WHERE ";
private static final String _SQL_COUNT_COMMERCEPRICINGCLASS =
"SELECT COUNT(commercePricingClass) FROM CommercePricingClass commercePricingClass";
private static final String _SQL_COUNT_COMMERCEPRICINGCLASS_WHERE =
"SELECT COUNT(commercePricingClass) FROM CommercePricingClass commercePricingClass WHERE ";
private static final String _FILTER_ENTITY_TABLE_FILTER_PK_COLUMN =
"commercePricingClass.commercePricingClassId";
private static final String _FILTER_SQL_SELECT_COMMERCEPRICINGCLASS_WHERE =
"SELECT DISTINCT {commercePricingClass.*} FROM CommercePricingClass commercePricingClass WHERE ";
private static final String
_FILTER_SQL_SELECT_COMMERCEPRICINGCLASS_NO_INLINE_DISTINCT_WHERE_1 =
"SELECT {CommercePricingClass.*} FROM (SELECT DISTINCT commercePricingClass.commercePricingClassId FROM CommercePricingClass commercePricingClass WHERE ";
private static final String
_FILTER_SQL_SELECT_COMMERCEPRICINGCLASS_NO_INLINE_DISTINCT_WHERE_2 =
") TEMP_TABLE INNER JOIN CommercePricingClass ON TEMP_TABLE.commercePricingClassId = CommercePricingClass.commercePricingClassId";
private static final String _FILTER_SQL_COUNT_COMMERCEPRICINGCLASS_WHERE =
"SELECT COUNT(DISTINCT commercePricingClass.commercePricingClassId) AS COUNT_VALUE FROM CommercePricingClass commercePricingClass WHERE ";
private static final String _FILTER_ENTITY_ALIAS = "commercePricingClass";
private static final String _FILTER_ENTITY_TABLE = "CommercePricingClass";
private static final String _ORDER_BY_ENTITY_ALIAS =
"commercePricingClass.";
private static final String _ORDER_BY_ENTITY_TABLE =
"CommercePricingClass.";
private static final String _NO_SUCH_ENTITY_WITH_PRIMARY_KEY =
"No CommercePricingClass exists with the primary key ";
private static final String _NO_SUCH_ENTITY_WITH_KEY =
"No CommercePricingClass exists with the key {";
private static final Log _log = LogFactoryUtil.getLog(
CommercePricingClassPersistenceImpl.class);
private static final Set _badColumnNames = SetUtil.fromArray(
new String[] {"uuid"});
@Override
protected FinderCache getFinderCache() {
return finderCache;
}
}