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

com.liferay.commerce.product.model.impl.CPInstanceUnitOfMeasureModelImpl Maven / Gradle / Ivy

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

package com.liferay.commerce.product.model.impl;

import com.liferay.commerce.product.model.CPInstanceUnitOfMeasure;
import com.liferay.commerce.product.model.CPInstanceUnitOfMeasureModel;
import com.liferay.expando.kernel.model.ExpandoBridge;
import com.liferay.expando.kernel.util.ExpandoBridgeFactoryUtil;
import com.liferay.exportimport.kernel.lar.StagedModelType;
import com.liferay.petra.string.StringBundler;
import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.exception.LocaleException;
import com.liferay.portal.kernel.exception.PortalException;
import com.liferay.portal.kernel.json.JSON;
import com.liferay.portal.kernel.model.CacheModel;
import com.liferay.portal.kernel.model.ModelWrapper;
import com.liferay.portal.kernel.model.User;
import com.liferay.portal.kernel.model.impl.BaseModelImpl;
import com.liferay.portal.kernel.service.ServiceContext;
import com.liferay.portal.kernel.service.UserLocalServiceUtil;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.LocaleUtil;
import com.liferay.portal.kernel.util.LocalizationUtil;
import com.liferay.portal.kernel.util.PortalUtil;
import com.liferay.portal.kernel.util.ProxyUtil;
import com.liferay.portal.kernel.util.StringUtil;
import com.liferay.portal.kernel.util.Validator;

import java.io.Serializable;

import java.lang.reflect.InvocationHandler;

import java.math.BigDecimal;

import java.sql.Blob;
import java.sql.Types;

import java.util.Collections;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.Locale;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import java.util.TreeSet;
import java.util.function.BiConsumer;
import java.util.function.Function;

/**
 * The base model implementation for the CPInstanceUnitOfMeasure service. Represents a row in the "CPInstanceUOM" database table, with each column mapped to a property of this class.
 *
 * 

* This implementation and its corresponding interface CPInstanceUnitOfMeasureModel exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link CPInstanceUnitOfMeasureImpl}. *

* * @author Marco Leo * @see CPInstanceUnitOfMeasureImpl * @generated */ @JSON(strict = true) public class CPInstanceUnitOfMeasureModelImpl extends BaseModelImpl implements CPInstanceUnitOfMeasureModel { /* * NOTE FOR DEVELOPERS: * * Never modify or reference this class directly. All methods that expect a cp instance unit of measure model instance should use the CPInstanceUnitOfMeasure interface instead. */ public static final String TABLE_NAME = "CPInstanceUOM"; public static final Object[][] TABLE_COLUMNS = { {"mvccVersion", Types.BIGINT}, {"ctCollectionId", Types.BIGINT}, {"uuid_", Types.VARCHAR}, {"CPInstanceUOMId", Types.BIGINT}, {"companyId", Types.BIGINT}, {"userId", Types.BIGINT}, {"userName", Types.VARCHAR}, {"createDate", Types.TIMESTAMP}, {"modifiedDate", Types.TIMESTAMP}, {"CPInstanceId", Types.BIGINT}, {"active_", Types.BOOLEAN}, {"incrementalOrderQuantity", Types.DECIMAL}, {"key_", Types.VARCHAR}, {"name", Types.VARCHAR}, {"precision_", Types.INTEGER}, {"pricingQuantity", Types.DECIMAL}, {"primary_", Types.BOOLEAN}, {"priority", Types.DOUBLE}, {"rate", Types.DECIMAL}, {"sku", Types.VARCHAR} }; public static final Map TABLE_COLUMNS_MAP = new HashMap(); static { TABLE_COLUMNS_MAP.put("mvccVersion", Types.BIGINT); TABLE_COLUMNS_MAP.put("ctCollectionId", Types.BIGINT); TABLE_COLUMNS_MAP.put("uuid_", Types.VARCHAR); TABLE_COLUMNS_MAP.put("CPInstanceUOMId", Types.BIGINT); TABLE_COLUMNS_MAP.put("companyId", Types.BIGINT); TABLE_COLUMNS_MAP.put("userId", Types.BIGINT); TABLE_COLUMNS_MAP.put("userName", Types.VARCHAR); TABLE_COLUMNS_MAP.put("createDate", Types.TIMESTAMP); TABLE_COLUMNS_MAP.put("modifiedDate", Types.TIMESTAMP); TABLE_COLUMNS_MAP.put("CPInstanceId", Types.BIGINT); TABLE_COLUMNS_MAP.put("active_", Types.BOOLEAN); TABLE_COLUMNS_MAP.put("incrementalOrderQuantity", Types.DECIMAL); TABLE_COLUMNS_MAP.put("key_", Types.VARCHAR); TABLE_COLUMNS_MAP.put("name", Types.VARCHAR); TABLE_COLUMNS_MAP.put("precision_", Types.INTEGER); TABLE_COLUMNS_MAP.put("pricingQuantity", Types.DECIMAL); TABLE_COLUMNS_MAP.put("primary_", Types.BOOLEAN); TABLE_COLUMNS_MAP.put("priority", Types.DOUBLE); TABLE_COLUMNS_MAP.put("rate", Types.DECIMAL); TABLE_COLUMNS_MAP.put("sku", Types.VARCHAR); } public static final String TABLE_SQL_CREATE = "create table CPInstanceUOM (mvccVersion LONG default 0 not null,ctCollectionId LONG default 0 not null,uuid_ VARCHAR(75) null,CPInstanceUOMId LONG not null,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,CPInstanceId LONG,active_ BOOLEAN,incrementalOrderQuantity BIGDECIMAL null,key_ VARCHAR(75) null,name STRING null,precision_ INTEGER,pricingQuantity BIGDECIMAL null,primary_ BOOLEAN,priority DOUBLE,rate BIGDECIMAL null,sku VARCHAR(75) null,primary key (CPInstanceUOMId, ctCollectionId))"; public static final String TABLE_SQL_DROP = "drop table CPInstanceUOM"; public static final String ORDER_BY_JPQL = " ORDER BY cpInstanceUnitOfMeasure.CPInstanceUnitOfMeasureId ASC"; public static final String ORDER_BY_SQL = " ORDER BY CPInstanceUOM.CPInstanceUOMId ASC"; public static final String DATA_SOURCE = "liferayDataSource"; public static final String SESSION_FACTORY = "liferaySessionFactory"; public static final String TX_MANAGER = "liferayTransactionManager"; /** * @deprecated As of Athanasius (7.3.x), replaced by {@link #getColumnBitmask(String)} */ @Deprecated public static final long CPINSTANCEID_COLUMN_BITMASK = 1L; /** * @deprecated As of Athanasius (7.3.x), replaced by {@link #getColumnBitmask(String)} */ @Deprecated public static final long ACTIVE_COLUMN_BITMASK = 2L; /** * @deprecated As of Athanasius (7.3.x), replaced by {@link #getColumnBitmask(String)} */ @Deprecated public static final long COMPANYID_COLUMN_BITMASK = 4L; /** * @deprecated As of Athanasius (7.3.x), replaced by {@link #getColumnBitmask(String)} */ @Deprecated public static final long KEY_COLUMN_BITMASK = 8L; /** * @deprecated As of Athanasius (7.3.x), replaced by {@link #getColumnBitmask(String)} */ @Deprecated public static final long PRIMARY_COLUMN_BITMASK = 16L; /** * @deprecated As of Athanasius (7.3.x), replaced by {@link #getColumnBitmask(String)} */ @Deprecated public static final long SKU_COLUMN_BITMASK = 32L; /** * @deprecated As of Athanasius (7.3.x), replaced by {@link #getColumnBitmask(String)} */ @Deprecated public static final long UUID_COLUMN_BITMASK = 64L; /** * @deprecated As of Athanasius (7.3.x), replaced by {@link * #getColumnBitmask(String)} */ @Deprecated public static final long CPINSTANCEUNITOFMEASUREID_COLUMN_BITMASK = 128L; /** * @deprecated As of Athanasius (7.3.x), with no direct replacement */ @Deprecated public static void setEntityCacheEnabled(boolean entityCacheEnabled) { } /** * @deprecated As of Athanasius (7.3.x), with no direct replacement */ @Deprecated public static void setFinderCacheEnabled(boolean finderCacheEnabled) { } public CPInstanceUnitOfMeasureModelImpl() { } @Override public long getPrimaryKey() { return _CPInstanceUnitOfMeasureId; } @Override public void setPrimaryKey(long primaryKey) { setCPInstanceUnitOfMeasureId(primaryKey); } @Override public Serializable getPrimaryKeyObj() { return _CPInstanceUnitOfMeasureId; } @Override public void setPrimaryKeyObj(Serializable primaryKeyObj) { setPrimaryKey(((Long)primaryKeyObj).longValue()); } @Override public Class getModelClass() { return CPInstanceUnitOfMeasure.class; } @Override public String getModelClassName() { return CPInstanceUnitOfMeasure.class.getName(); } @Override public Map getModelAttributes() { Map attributes = new HashMap(); Map> attributeGetterFunctions = getAttributeGetterFunctions(); for (Map.Entry> entry : attributeGetterFunctions.entrySet()) { String attributeName = entry.getKey(); Function attributeGetterFunction = entry.getValue(); attributes.put( attributeName, attributeGetterFunction.apply((CPInstanceUnitOfMeasure)this)); } return attributes; } @Override public void setModelAttributes(Map attributes) { Map> attributeSetterBiConsumers = getAttributeSetterBiConsumers(); for (Map.Entry entry : attributes.entrySet()) { String attributeName = entry.getKey(); BiConsumer attributeSetterBiConsumer = attributeSetterBiConsumers.get( attributeName); if (attributeSetterBiConsumer != null) { attributeSetterBiConsumer.accept( (CPInstanceUnitOfMeasure)this, entry.getValue()); } } } public Map> getAttributeGetterFunctions() { return AttributeGetterFunctionsHolder._attributeGetterFunctions; } public Map> getAttributeSetterBiConsumers() { return AttributeSetterBiConsumersHolder._attributeSetterBiConsumers; } private static class AttributeGetterFunctionsHolder { private static final Map > _attributeGetterFunctions; static { Map> attributeGetterFunctions = new LinkedHashMap >(); attributeGetterFunctions.put( "mvccVersion", CPInstanceUnitOfMeasure::getMvccVersion); attributeGetterFunctions.put( "ctCollectionId", CPInstanceUnitOfMeasure::getCtCollectionId); attributeGetterFunctions.put( "uuid", CPInstanceUnitOfMeasure::getUuid); attributeGetterFunctions.put( "CPInstanceUnitOfMeasureId", CPInstanceUnitOfMeasure::getCPInstanceUnitOfMeasureId); attributeGetterFunctions.put( "companyId", CPInstanceUnitOfMeasure::getCompanyId); attributeGetterFunctions.put( "userId", CPInstanceUnitOfMeasure::getUserId); attributeGetterFunctions.put( "userName", CPInstanceUnitOfMeasure::getUserName); attributeGetterFunctions.put( "createDate", CPInstanceUnitOfMeasure::getCreateDate); attributeGetterFunctions.put( "modifiedDate", CPInstanceUnitOfMeasure::getModifiedDate); attributeGetterFunctions.put( "CPInstanceId", CPInstanceUnitOfMeasure::getCPInstanceId); attributeGetterFunctions.put( "active", CPInstanceUnitOfMeasure::getActive); attributeGetterFunctions.put( "incrementalOrderQuantity", CPInstanceUnitOfMeasure::getIncrementalOrderQuantity); attributeGetterFunctions.put( "key", CPInstanceUnitOfMeasure::getKey); attributeGetterFunctions.put( "name", CPInstanceUnitOfMeasure::getName); attributeGetterFunctions.put( "precision", CPInstanceUnitOfMeasure::getPrecision); attributeGetterFunctions.put( "pricingQuantity", CPInstanceUnitOfMeasure::getPricingQuantity); attributeGetterFunctions.put( "primary", CPInstanceUnitOfMeasure::getPrimary); attributeGetterFunctions.put( "priority", CPInstanceUnitOfMeasure::getPriority); attributeGetterFunctions.put( "rate", CPInstanceUnitOfMeasure::getRate); attributeGetterFunctions.put( "sku", CPInstanceUnitOfMeasure::getSku); _attributeGetterFunctions = Collections.unmodifiableMap( attributeGetterFunctions); } } private static class AttributeSetterBiConsumersHolder { private static final Map > _attributeSetterBiConsumers; static { Map> attributeSetterBiConsumers = new LinkedHashMap >(); attributeSetterBiConsumers.put( "mvccVersion", (BiConsumer) CPInstanceUnitOfMeasure::setMvccVersion); attributeSetterBiConsumers.put( "ctCollectionId", (BiConsumer) CPInstanceUnitOfMeasure::setCtCollectionId); attributeSetterBiConsumers.put( "uuid", (BiConsumer) CPInstanceUnitOfMeasure::setUuid); attributeSetterBiConsumers.put( "CPInstanceUnitOfMeasureId", (BiConsumer) CPInstanceUnitOfMeasure::setCPInstanceUnitOfMeasureId); attributeSetterBiConsumers.put( "companyId", (BiConsumer) CPInstanceUnitOfMeasure::setCompanyId); attributeSetterBiConsumers.put( "userId", (BiConsumer) CPInstanceUnitOfMeasure::setUserId); attributeSetterBiConsumers.put( "userName", (BiConsumer) CPInstanceUnitOfMeasure::setUserName); attributeSetterBiConsumers.put( "createDate", (BiConsumer) CPInstanceUnitOfMeasure::setCreateDate); attributeSetterBiConsumers.put( "modifiedDate", (BiConsumer) CPInstanceUnitOfMeasure::setModifiedDate); attributeSetterBiConsumers.put( "CPInstanceId", (BiConsumer) CPInstanceUnitOfMeasure::setCPInstanceId); attributeSetterBiConsumers.put( "active", (BiConsumer) CPInstanceUnitOfMeasure::setActive); attributeSetterBiConsumers.put( "incrementalOrderQuantity", (BiConsumer) CPInstanceUnitOfMeasure::setIncrementalOrderQuantity); attributeSetterBiConsumers.put( "key", (BiConsumer) CPInstanceUnitOfMeasure::setKey); attributeSetterBiConsumers.put( "name", (BiConsumer) CPInstanceUnitOfMeasure::setName); attributeSetterBiConsumers.put( "precision", (BiConsumer) CPInstanceUnitOfMeasure::setPrecision); attributeSetterBiConsumers.put( "pricingQuantity", (BiConsumer) CPInstanceUnitOfMeasure::setPricingQuantity); attributeSetterBiConsumers.put( "primary", (BiConsumer) CPInstanceUnitOfMeasure::setPrimary); attributeSetterBiConsumers.put( "priority", (BiConsumer) CPInstanceUnitOfMeasure::setPriority); attributeSetterBiConsumers.put( "rate", (BiConsumer) CPInstanceUnitOfMeasure::setRate); attributeSetterBiConsumers.put( "sku", (BiConsumer) CPInstanceUnitOfMeasure::setSku); _attributeSetterBiConsumers = Collections.unmodifiableMap( (Map)attributeSetterBiConsumers); } } @JSON @Override public long getMvccVersion() { return _mvccVersion; } @Override public void setMvccVersion(long mvccVersion) { if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } _mvccVersion = mvccVersion; } @JSON @Override public long getCtCollectionId() { return _ctCollectionId; } @Override public void setCtCollectionId(long ctCollectionId) { if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } _ctCollectionId = ctCollectionId; } @JSON @Override public String getUuid() { if (_uuid == null) { return ""; } else { return _uuid; } } @Override public void setUuid(String uuid) { if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } _uuid = uuid; } /** * @deprecated As of Athanasius (7.3.x), replaced by {@link * #getColumnOriginalValue(String)} */ @Deprecated public String getOriginalUuid() { return getColumnOriginalValue("uuid_"); } @JSON @Override public long getCPInstanceUnitOfMeasureId() { return _CPInstanceUnitOfMeasureId; } @Override public void setCPInstanceUnitOfMeasureId(long CPInstanceUnitOfMeasureId) { if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } _CPInstanceUnitOfMeasureId = CPInstanceUnitOfMeasureId; } @JSON @Override public long getCompanyId() { return _companyId; } @Override public void setCompanyId(long companyId) { if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } _companyId = companyId; } /** * @deprecated As of Athanasius (7.3.x), replaced by {@link * #getColumnOriginalValue(String)} */ @Deprecated public long getOriginalCompanyId() { return GetterUtil.getLong( this.getColumnOriginalValue("companyId")); } @JSON @Override public long getUserId() { return _userId; } @Override public void setUserId(long userId) { if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } _userId = userId; } @Override public String getUserUuid() { try { User user = UserLocalServiceUtil.getUserById(getUserId()); return user.getUuid(); } catch (PortalException portalException) { return ""; } } @Override public void setUserUuid(String userUuid) { } @JSON @Override public String getUserName() { if (_userName == null) { return ""; } else { return _userName; } } @Override public void setUserName(String userName) { if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } _userName = userName; } @JSON @Override public Date getCreateDate() { return _createDate; } @Override public void setCreateDate(Date createDate) { if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } _createDate = createDate; } @JSON @Override public Date getModifiedDate() { return _modifiedDate; } public boolean hasSetModifiedDate() { return _setModifiedDate; } @Override public void setModifiedDate(Date modifiedDate) { _setModifiedDate = true; if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } _modifiedDate = modifiedDate; } @JSON @Override public long getCPInstanceId() { return _CPInstanceId; } @Override public void setCPInstanceId(long CPInstanceId) { if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } _CPInstanceId = CPInstanceId; } /** * @deprecated As of Athanasius (7.3.x), replaced by {@link * #getColumnOriginalValue(String)} */ @Deprecated public long getOriginalCPInstanceId() { return GetterUtil.getLong( this.getColumnOriginalValue("CPInstanceId")); } @JSON @Override public boolean getActive() { return _active; } @JSON @Override public boolean isActive() { return _active; } @Override public void setActive(boolean active) { if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } _active = active; } /** * @deprecated As of Athanasius (7.3.x), replaced by {@link * #getColumnOriginalValue(String)} */ @Deprecated public boolean getOriginalActive() { return GetterUtil.getBoolean( this.getColumnOriginalValue("active_")); } @JSON @Override public BigDecimal getIncrementalOrderQuantity() { return _incrementalOrderQuantity; } @Override public void setIncrementalOrderQuantity( BigDecimal incrementalOrderQuantity) { if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } _incrementalOrderQuantity = incrementalOrderQuantity; } @JSON @Override public String getKey() { if (_key == null) { return ""; } else { return _key; } } @Override public void setKey(String key) { if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } _key = key; } /** * @deprecated As of Athanasius (7.3.x), replaced by {@link * #getColumnOriginalValue(String)} */ @Deprecated public String getOriginalKey() { return getColumnOriginalValue("key_"); } @JSON @Override public String getName() { if (_name == null) { return ""; } else { return _name; } } @Override public String getName(Locale locale) { String languageId = LocaleUtil.toLanguageId(locale); return getName(languageId); } @Override public String getName(Locale locale, boolean useDefault) { String languageId = LocaleUtil.toLanguageId(locale); return getName(languageId, useDefault); } @Override public String getName(String languageId) { return LocalizationUtil.getLocalization(getName(), languageId); } @Override public String getName(String languageId, boolean useDefault) { return LocalizationUtil.getLocalization( getName(), languageId, useDefault); } @Override public String getNameCurrentLanguageId() { return _nameCurrentLanguageId; } @JSON @Override public String getNameCurrentValue() { Locale locale = getLocale(_nameCurrentLanguageId); return getName(locale); } @Override public Map getNameMap() { return LocalizationUtil.getLocalizationMap(getName()); } @Override public void setName(String name) { if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } _name = name; } @Override public void setName(String name, Locale locale) { setName(name, locale, LocaleUtil.getDefault()); } @Override public void setName(String name, Locale locale, Locale defaultLocale) { String languageId = LocaleUtil.toLanguageId(locale); String defaultLanguageId = LocaleUtil.toLanguageId(defaultLocale); if (Validator.isNotNull(name)) { setName( LocalizationUtil.updateLocalization( getName(), "Name", name, languageId, defaultLanguageId)); } else { setName( LocalizationUtil.removeLocalization( getName(), "Name", languageId)); } } @Override public void setNameCurrentLanguageId(String languageId) { _nameCurrentLanguageId = languageId; } @Override public void setNameMap(Map nameMap) { setNameMap(nameMap, LocaleUtil.getDefault()); } @Override public void setNameMap(Map nameMap, Locale defaultLocale) { if (nameMap == null) { return; } setName( LocalizationUtil.updateLocalization( nameMap, getName(), "Name", LocaleUtil.toLanguageId(defaultLocale))); } @JSON @Override public int getPrecision() { return _precision; } @Override public void setPrecision(int precision) { if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } _precision = precision; } @JSON @Override public BigDecimal getPricingQuantity() { return _pricingQuantity; } @Override public void setPricingQuantity(BigDecimal pricingQuantity) { if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } _pricingQuantity = pricingQuantity; } @JSON @Override public boolean getPrimary() { return _primary; } @JSON @Override public boolean isPrimary() { return _primary; } @Override public void setPrimary(boolean primary) { if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } _primary = primary; } /** * @deprecated As of Athanasius (7.3.x), replaced by {@link * #getColumnOriginalValue(String)} */ @Deprecated public boolean getOriginalPrimary() { return GetterUtil.getBoolean( this.getColumnOriginalValue("primary_")); } @JSON @Override public double getPriority() { return _priority; } @Override public void setPriority(double priority) { if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } _priority = priority; } @JSON @Override public BigDecimal getRate() { return _rate; } @Override public void setRate(BigDecimal rate) { if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } _rate = rate; } @JSON @Override public String getSku() { if (_sku == null) { return ""; } else { return _sku; } } @Override public void setSku(String sku) { if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } _sku = sku; } /** * @deprecated As of Athanasius (7.3.x), replaced by {@link * #getColumnOriginalValue(String)} */ @Deprecated public String getOriginalSku() { return getColumnOriginalValue("sku"); } @Override public StagedModelType getStagedModelType() { return new StagedModelType( PortalUtil.getClassNameId(CPInstanceUnitOfMeasure.class.getName())); } public long getColumnBitmask() { if (_columnBitmask > 0) { return _columnBitmask; } if ((_columnOriginalValues == null) || (_columnOriginalValues == Collections.EMPTY_MAP)) { return 0; } for (Map.Entry entry : _columnOriginalValues.entrySet()) { if (!Objects.equals( entry.getValue(), getColumnValue(entry.getKey()))) { _columnBitmask |= _columnBitmasks.get(entry.getKey()); } } return _columnBitmask; } @Override public ExpandoBridge getExpandoBridge() { return ExpandoBridgeFactoryUtil.getExpandoBridge( getCompanyId(), CPInstanceUnitOfMeasure.class.getName(), getPrimaryKey()); } @Override public void setExpandoBridgeAttributes(ServiceContext serviceContext) { ExpandoBridge expandoBridge = getExpandoBridge(); expandoBridge.setAttributes(serviceContext); } @Override public String[] getAvailableLanguageIds() { Set availableLanguageIds = new TreeSet(); Map nameMap = getNameMap(); for (Map.Entry entry : nameMap.entrySet()) { Locale locale = entry.getKey(); String value = entry.getValue(); if (Validator.isNotNull(value)) { availableLanguageIds.add(LocaleUtil.toLanguageId(locale)); } } return availableLanguageIds.toArray( new String[availableLanguageIds.size()]); } @Override public String getDefaultLanguageId() { String xml = getName(); if (xml == null) { return ""; } Locale defaultLocale = LocaleUtil.getDefault(); return LocalizationUtil.getDefaultLanguageId(xml, defaultLocale); } @Override public void prepareLocalizedFieldsForImport() throws LocaleException { Locale defaultLocale = LocaleUtil.fromLanguageId( getDefaultLanguageId()); Locale[] availableLocales = LocaleUtil.fromLanguageIds( getAvailableLanguageIds()); Locale defaultImportLocale = LocalizationUtil.getDefaultImportLocale( CPInstanceUnitOfMeasure.class.getName(), getPrimaryKey(), defaultLocale, availableLocales); prepareLocalizedFieldsForImport(defaultImportLocale); } @Override @SuppressWarnings("unused") public void prepareLocalizedFieldsForImport(Locale defaultImportLocale) throws LocaleException { Locale defaultLocale = LocaleUtil.getDefault(); String modelDefaultLanguageId = getDefaultLanguageId(); String name = getName(defaultLocale); if (Validator.isNull(name)) { setName(getName(modelDefaultLanguageId), defaultLocale); } else { setName(getName(defaultLocale), defaultLocale, defaultLocale); } } @Override public CPInstanceUnitOfMeasure toEscapedModel() { if (_escapedModel == null) { Function escapedModelProxyProviderFunction = EscapedModelProxyProviderFunctionHolder. _escapedModelProxyProviderFunction; _escapedModel = escapedModelProxyProviderFunction.apply( new AutoEscapeBeanHandler(this)); } return _escapedModel; } @Override public Object clone() { CPInstanceUnitOfMeasureImpl cpInstanceUnitOfMeasureImpl = new CPInstanceUnitOfMeasureImpl(); cpInstanceUnitOfMeasureImpl.setMvccVersion(getMvccVersion()); cpInstanceUnitOfMeasureImpl.setCtCollectionId(getCtCollectionId()); cpInstanceUnitOfMeasureImpl.setUuid(getUuid()); cpInstanceUnitOfMeasureImpl.setCPInstanceUnitOfMeasureId( getCPInstanceUnitOfMeasureId()); cpInstanceUnitOfMeasureImpl.setCompanyId(getCompanyId()); cpInstanceUnitOfMeasureImpl.setUserId(getUserId()); cpInstanceUnitOfMeasureImpl.setUserName(getUserName()); cpInstanceUnitOfMeasureImpl.setCreateDate(getCreateDate()); cpInstanceUnitOfMeasureImpl.setModifiedDate(getModifiedDate()); cpInstanceUnitOfMeasureImpl.setCPInstanceId(getCPInstanceId()); cpInstanceUnitOfMeasureImpl.setActive(isActive()); cpInstanceUnitOfMeasureImpl.setIncrementalOrderQuantity( getIncrementalOrderQuantity()); cpInstanceUnitOfMeasureImpl.setKey(getKey()); cpInstanceUnitOfMeasureImpl.setName(getName()); cpInstanceUnitOfMeasureImpl.setPrecision(getPrecision()); cpInstanceUnitOfMeasureImpl.setPricingQuantity(getPricingQuantity()); cpInstanceUnitOfMeasureImpl.setPrimary(isPrimary()); cpInstanceUnitOfMeasureImpl.setPriority(getPriority()); cpInstanceUnitOfMeasureImpl.setRate(getRate()); cpInstanceUnitOfMeasureImpl.setSku(getSku()); cpInstanceUnitOfMeasureImpl.resetOriginalValues(); return cpInstanceUnitOfMeasureImpl; } @Override public CPInstanceUnitOfMeasure cloneWithOriginalValues() { CPInstanceUnitOfMeasureImpl cpInstanceUnitOfMeasureImpl = new CPInstanceUnitOfMeasureImpl(); cpInstanceUnitOfMeasureImpl.setMvccVersion( this.getColumnOriginalValue("mvccVersion")); cpInstanceUnitOfMeasureImpl.setCtCollectionId( this.getColumnOriginalValue("ctCollectionId")); cpInstanceUnitOfMeasureImpl.setUuid( this.getColumnOriginalValue("uuid_")); cpInstanceUnitOfMeasureImpl.setCPInstanceUnitOfMeasureId( this.getColumnOriginalValue("CPInstanceUOMId")); cpInstanceUnitOfMeasureImpl.setCompanyId( this.getColumnOriginalValue("companyId")); cpInstanceUnitOfMeasureImpl.setUserId( this.getColumnOriginalValue("userId")); cpInstanceUnitOfMeasureImpl.setUserName( this.getColumnOriginalValue("userName")); cpInstanceUnitOfMeasureImpl.setCreateDate( this.getColumnOriginalValue("createDate")); cpInstanceUnitOfMeasureImpl.setModifiedDate( this.getColumnOriginalValue("modifiedDate")); cpInstanceUnitOfMeasureImpl.setCPInstanceId( this.getColumnOriginalValue("CPInstanceId")); cpInstanceUnitOfMeasureImpl.setActive( this.getColumnOriginalValue("active_")); cpInstanceUnitOfMeasureImpl.setIncrementalOrderQuantity( this.getColumnOriginalValue( "incrementalOrderQuantity")); cpInstanceUnitOfMeasureImpl.setKey( this.getColumnOriginalValue("key_")); cpInstanceUnitOfMeasureImpl.setName( this.getColumnOriginalValue("name")); cpInstanceUnitOfMeasureImpl.setPrecision( this.getColumnOriginalValue("precision_")); cpInstanceUnitOfMeasureImpl.setPricingQuantity( this.getColumnOriginalValue("pricingQuantity")); cpInstanceUnitOfMeasureImpl.setPrimary( this.getColumnOriginalValue("primary_")); cpInstanceUnitOfMeasureImpl.setPriority( this.getColumnOriginalValue("priority")); cpInstanceUnitOfMeasureImpl.setRate( this.getColumnOriginalValue("rate")); cpInstanceUnitOfMeasureImpl.setSku( this.getColumnOriginalValue("sku")); return cpInstanceUnitOfMeasureImpl; } @Override public int compareTo(CPInstanceUnitOfMeasure cpInstanceUnitOfMeasure) { long primaryKey = cpInstanceUnitOfMeasure.getPrimaryKey(); if (getPrimaryKey() < primaryKey) { return -1; } else if (getPrimaryKey() > primaryKey) { return 1; } else { return 0; } } @Override public boolean equals(Object object) { if (this == object) { return true; } if (!(object instanceof CPInstanceUnitOfMeasure)) { return false; } CPInstanceUnitOfMeasure cpInstanceUnitOfMeasure = (CPInstanceUnitOfMeasure)object; long primaryKey = cpInstanceUnitOfMeasure.getPrimaryKey(); if (getPrimaryKey() == primaryKey) { return true; } else { return false; } } @Override public int hashCode() { return (int)getPrimaryKey(); } /** * @deprecated As of Athanasius (7.3.x), with no direct replacement */ @Deprecated @Override public boolean isEntityCacheEnabled() { return true; } /** * @deprecated As of Athanasius (7.3.x), with no direct replacement */ @Deprecated @Override public boolean isFinderCacheEnabled() { return true; } @Override public void resetOriginalValues() { _columnOriginalValues = Collections.emptyMap(); _setModifiedDate = false; _columnBitmask = 0; } @Override public CacheModel toCacheModel() { CPInstanceUnitOfMeasureCacheModel cpInstanceUnitOfMeasureCacheModel = new CPInstanceUnitOfMeasureCacheModel(); cpInstanceUnitOfMeasureCacheModel.mvccVersion = getMvccVersion(); cpInstanceUnitOfMeasureCacheModel.ctCollectionId = getCtCollectionId(); cpInstanceUnitOfMeasureCacheModel.uuid = getUuid(); String uuid = cpInstanceUnitOfMeasureCacheModel.uuid; if ((uuid != null) && (uuid.length() == 0)) { cpInstanceUnitOfMeasureCacheModel.uuid = null; } cpInstanceUnitOfMeasureCacheModel.CPInstanceUnitOfMeasureId = getCPInstanceUnitOfMeasureId(); cpInstanceUnitOfMeasureCacheModel.companyId = getCompanyId(); cpInstanceUnitOfMeasureCacheModel.userId = getUserId(); cpInstanceUnitOfMeasureCacheModel.userName = getUserName(); String userName = cpInstanceUnitOfMeasureCacheModel.userName; if ((userName != null) && (userName.length() == 0)) { cpInstanceUnitOfMeasureCacheModel.userName = null; } Date createDate = getCreateDate(); if (createDate != null) { cpInstanceUnitOfMeasureCacheModel.createDate = createDate.getTime(); } else { cpInstanceUnitOfMeasureCacheModel.createDate = Long.MIN_VALUE; } Date modifiedDate = getModifiedDate(); if (modifiedDate != null) { cpInstanceUnitOfMeasureCacheModel.modifiedDate = modifiedDate.getTime(); } else { cpInstanceUnitOfMeasureCacheModel.modifiedDate = Long.MIN_VALUE; } cpInstanceUnitOfMeasureCacheModel.CPInstanceId = getCPInstanceId(); cpInstanceUnitOfMeasureCacheModel.active = isActive(); cpInstanceUnitOfMeasureCacheModel.incrementalOrderQuantity = getIncrementalOrderQuantity(); cpInstanceUnitOfMeasureCacheModel.key = getKey(); String key = cpInstanceUnitOfMeasureCacheModel.key; if ((key != null) && (key.length() == 0)) { cpInstanceUnitOfMeasureCacheModel.key = null; } cpInstanceUnitOfMeasureCacheModel.name = getName(); String name = cpInstanceUnitOfMeasureCacheModel.name; if ((name != null) && (name.length() == 0)) { cpInstanceUnitOfMeasureCacheModel.name = null; } cpInstanceUnitOfMeasureCacheModel.precision = getPrecision(); cpInstanceUnitOfMeasureCacheModel.pricingQuantity = getPricingQuantity(); cpInstanceUnitOfMeasureCacheModel.primary = isPrimary(); cpInstanceUnitOfMeasureCacheModel.priority = getPriority(); cpInstanceUnitOfMeasureCacheModel.rate = getRate(); cpInstanceUnitOfMeasureCacheModel.sku = getSku(); String sku = cpInstanceUnitOfMeasureCacheModel.sku; if ((sku != null) && (sku.length() == 0)) { cpInstanceUnitOfMeasureCacheModel.sku = null; } return cpInstanceUnitOfMeasureCacheModel; } @Override public String toString() { Map> attributeGetterFunctions = getAttributeGetterFunctions(); StringBundler sb = new StringBundler( (5 * attributeGetterFunctions.size()) + 2); sb.append("{"); for (Map.Entry> entry : attributeGetterFunctions.entrySet()) { String attributeName = entry.getKey(); Function attributeGetterFunction = entry.getValue(); sb.append("\""); sb.append(attributeName); sb.append("\": "); Object value = attributeGetterFunction.apply( (CPInstanceUnitOfMeasure)this); if (value == null) { sb.append("null"); } else if (value instanceof Blob || value instanceof Date || value instanceof Map || value instanceof String) { sb.append( "\"" + StringUtil.replace(value.toString(), "\"", "'") + "\""); } else { sb.append(value); } sb.append(", "); } if (sb.index() > 1) { sb.setIndex(sb.index() - 1); } sb.append("}"); return sb.toString(); } private static class EscapedModelProxyProviderFunctionHolder { private static final Function _escapedModelProxyProviderFunction = ProxyUtil.getProxyProviderFunction( CPInstanceUnitOfMeasure.class, ModelWrapper.class); } private long _mvccVersion; private long _ctCollectionId; private String _uuid; private long _CPInstanceUnitOfMeasureId; private long _companyId; private long _userId; private String _userName; private Date _createDate; private Date _modifiedDate; private boolean _setModifiedDate; private long _CPInstanceId; private boolean _active; private BigDecimal _incrementalOrderQuantity; private String _key; private String _name; private String _nameCurrentLanguageId; private int _precision; private BigDecimal _pricingQuantity; private boolean _primary; private double _priority; private BigDecimal _rate; private String _sku; public T getColumnValue(String columnName) { columnName = _attributeNames.getOrDefault(columnName, columnName); Function function = AttributeGetterFunctionsHolder._attributeGetterFunctions.get( columnName); if (function == null) { throw new IllegalArgumentException( "No attribute getter function found for " + columnName); } return (T)function.apply((CPInstanceUnitOfMeasure)this); } public T getColumnOriginalValue(String columnName) { if (_columnOriginalValues == null) { return null; } if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } return (T)_columnOriginalValues.get(columnName); } private void _setColumnOriginalValues() { _columnOriginalValues = new HashMap(); _columnOriginalValues.put("mvccVersion", _mvccVersion); _columnOriginalValues.put("ctCollectionId", _ctCollectionId); _columnOriginalValues.put("uuid_", _uuid); _columnOriginalValues.put( "CPInstanceUOMId", _CPInstanceUnitOfMeasureId); _columnOriginalValues.put("companyId", _companyId); _columnOriginalValues.put("userId", _userId); _columnOriginalValues.put("userName", _userName); _columnOriginalValues.put("createDate", _createDate); _columnOriginalValues.put("modifiedDate", _modifiedDate); _columnOriginalValues.put("CPInstanceId", _CPInstanceId); _columnOriginalValues.put("active_", _active); _columnOriginalValues.put( "incrementalOrderQuantity", _incrementalOrderQuantity); _columnOriginalValues.put("key_", _key); _columnOriginalValues.put("name", _name); _columnOriginalValues.put("precision_", _precision); _columnOriginalValues.put("pricingQuantity", _pricingQuantity); _columnOriginalValues.put("primary_", _primary); _columnOriginalValues.put("priority", _priority); _columnOriginalValues.put("rate", _rate); _columnOriginalValues.put("sku", _sku); } private static final Map _attributeNames; static { Map attributeNames = new HashMap<>(); attributeNames.put("uuid_", "uuid"); attributeNames.put("CPInstanceUOMId", "CPInstanceUnitOfMeasureId"); attributeNames.put("active_", "active"); attributeNames.put("key_", "key"); attributeNames.put("precision_", "precision"); attributeNames.put("primary_", "primary"); _attributeNames = Collections.unmodifiableMap(attributeNames); } private transient Map _columnOriginalValues; public static long getColumnBitmask(String columnName) { return _columnBitmasks.get(columnName); } private static final Map _columnBitmasks; static { Map columnBitmasks = new HashMap<>(); columnBitmasks.put("mvccVersion", 1L); columnBitmasks.put("ctCollectionId", 2L); columnBitmasks.put("uuid_", 4L); columnBitmasks.put("CPInstanceUOMId", 8L); columnBitmasks.put("companyId", 16L); columnBitmasks.put("userId", 32L); columnBitmasks.put("userName", 64L); columnBitmasks.put("createDate", 128L); columnBitmasks.put("modifiedDate", 256L); columnBitmasks.put("CPInstanceId", 512L); columnBitmasks.put("active_", 1024L); columnBitmasks.put("incrementalOrderQuantity", 2048L); columnBitmasks.put("key_", 4096L); columnBitmasks.put("name", 8192L); columnBitmasks.put("precision_", 16384L); columnBitmasks.put("pricingQuantity", 32768L); columnBitmasks.put("primary_", 65536L); columnBitmasks.put("priority", 131072L); columnBitmasks.put("rate", 262144L); columnBitmasks.put("sku", 524288L); _columnBitmasks = Collections.unmodifiableMap(columnBitmasks); } private long _columnBitmask; private CPInstanceUnitOfMeasure _escapedModel; }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy