com.liferay.commerce.pricing.service.persistence.impl.CommercePriceModifierModelArgumentsResolver Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of com.liferay.commerce.pricing.service
Show all versions of com.liferay.commerce.pricing.service
Liferay Commerce Pricing Service
The newest version!
/**
* SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
* SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
*/
package com.liferay.commerce.pricing.service.persistence.impl;
import com.liferay.commerce.pricing.model.CommercePriceModifierTable;
import com.liferay.commerce.pricing.model.impl.CommercePriceModifierImpl;
import com.liferay.commerce.pricing.model.impl.CommercePriceModifierModelImpl;
import com.liferay.portal.kernel.dao.orm.ArgumentsResolver;
import com.liferay.portal.kernel.dao.orm.FinderPath;
import com.liferay.portal.kernel.model.BaseModel;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.osgi.service.component.annotations.Component;
/**
* The arguments resolver class for retrieving value from CommercePriceModifier.
*
* @author Riccardo Alberti
* @generated
*/
@Component(
property = {
"class.name=com.liferay.commerce.pricing.model.impl.CommercePriceModifierImpl",
"table.name=CommercePriceModifier"
},
service = ArgumentsResolver.class
)
public class CommercePriceModifierModelArgumentsResolver
implements ArgumentsResolver {
@Override
public Object[] getArguments(
FinderPath finderPath, BaseModel> baseModel, boolean checkColumn,
boolean original) {
String[] columnNames = finderPath.getColumnNames();
if ((columnNames == null) || (columnNames.length == 0)) {
if (baseModel.isNew()) {
return new Object[0];
}
return null;
}
CommercePriceModifierModelImpl commercePriceModifierModelImpl =
(CommercePriceModifierModelImpl)baseModel;
long columnBitmask = commercePriceModifierModelImpl.getColumnBitmask();
if (!checkColumn || (columnBitmask == 0)) {
return _getValue(
commercePriceModifierModelImpl, columnNames, original);
}
Long finderPathColumnBitmask = _finderPathColumnBitmasksCache.get(
finderPath);
if (finderPathColumnBitmask == null) {
finderPathColumnBitmask = 0L;
for (String columnName : columnNames) {
finderPathColumnBitmask |=
commercePriceModifierModelImpl.getColumnBitmask(columnName);
}
if (finderPath.isBaseModelResult() &&
(CommercePriceModifierPersistenceImpl.
FINDER_CLASS_NAME_LIST_WITHOUT_PAGINATION ==
finderPath.getCacheName())) {
finderPathColumnBitmask |= _ORDER_BY_COLUMNS_BITMASK;
}
_finderPathColumnBitmasksCache.put(
finderPath, finderPathColumnBitmask);
}
if ((columnBitmask & finderPathColumnBitmask) != 0) {
return _getValue(
commercePriceModifierModelImpl, columnNames, original);
}
return null;
}
@Override
public String getClassName() {
return CommercePriceModifierImpl.class.getName();
}
@Override
public String getTableName() {
return CommercePriceModifierTable.INSTANCE.getTableName();
}
private static Object[] _getValue(
CommercePriceModifierModelImpl commercePriceModifierModelImpl,
String[] columnNames, boolean original) {
Object[] arguments = new Object[columnNames.length];
for (int i = 0; i < arguments.length; i++) {
String columnName = columnNames[i];
if (original) {
arguments[i] =
commercePriceModifierModelImpl.getColumnOriginalValue(
columnName);
}
else {
arguments[i] = commercePriceModifierModelImpl.getColumnValue(
columnName);
}
}
return arguments;
}
private static final Map _finderPathColumnBitmasksCache =
new ConcurrentHashMap<>();
private static final long _ORDER_BY_COLUMNS_BITMASK;
static {
long orderByColumnsBitmask = 0;
orderByColumnsBitmask |=
CommercePriceModifierModelImpl.getColumnBitmask("displayDate");
orderByColumnsBitmask |=
CommercePriceModifierModelImpl.getColumnBitmask("createDate");
orderByColumnsBitmask |=
CommercePriceModifierModelImpl.getColumnBitmask("priority");
_ORDER_BY_COLUMNS_BITMASK = orderByColumnsBitmask;
}
}