com.liferay.dynamic.data.mapping.service.persistence.impl.DDMFieldAttributeModelArgumentsResolver Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of com.liferay.dynamic.data.mapping.service Show documentation
Show all versions of com.liferay.dynamic.data.mapping.service Show documentation
Liferay Dynamic Data Mapping 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.dynamic.data.mapping.service.persistence.impl;
import com.liferay.dynamic.data.mapping.model.DDMFieldAttributeTable;
import com.liferay.dynamic.data.mapping.model.impl.DDMFieldAttributeImpl;
import com.liferay.dynamic.data.mapping.model.impl.DDMFieldAttributeModelImpl;
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 DDMFieldAttribute.
*
* @author Brian Wing Shun Chan
* @generated
*/
@Component(
property = {
"class.name=com.liferay.dynamic.data.mapping.model.impl.DDMFieldAttributeImpl",
"table.name=DDMFieldAttribute"
},
service = ArgumentsResolver.class
)
public class DDMFieldAttributeModelArgumentsResolver
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;
}
DDMFieldAttributeModelImpl ddmFieldAttributeModelImpl =
(DDMFieldAttributeModelImpl)baseModel;
long columnBitmask = ddmFieldAttributeModelImpl.getColumnBitmask();
if (!checkColumn || (columnBitmask == 0)) {
return _getValue(ddmFieldAttributeModelImpl, columnNames, original);
}
Long finderPathColumnBitmask = _finderPathColumnBitmasksCache.get(
finderPath);
if (finderPathColumnBitmask == null) {
finderPathColumnBitmask = 0L;
for (String columnName : columnNames) {
finderPathColumnBitmask |=
ddmFieldAttributeModelImpl.getColumnBitmask(columnName);
}
_finderPathColumnBitmasksCache.put(
finderPath, finderPathColumnBitmask);
}
if ((columnBitmask & finderPathColumnBitmask) != 0) {
return _getValue(ddmFieldAttributeModelImpl, columnNames, original);
}
return null;
}
@Override
public String getClassName() {
return DDMFieldAttributeImpl.class.getName();
}
@Override
public String getTableName() {
return DDMFieldAttributeTable.INSTANCE.getTableName();
}
private static Object[] _getValue(
DDMFieldAttributeModelImpl ddmFieldAttributeModelImpl,
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] =
ddmFieldAttributeModelImpl.getColumnOriginalValue(
columnName);
}
else {
arguments[i] = ddmFieldAttributeModelImpl.getColumnValue(
columnName);
}
}
return arguments;
}
private static final Map _finderPathColumnBitmasksCache =
new ConcurrentHashMap<>();
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy