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

com.liferay.portal.model.impl.CountryModelImpl Maven / Gradle / Ivy

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

package com.liferay.portal.model.impl;

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.PortalException;
import com.liferay.portal.kernel.json.JSON;
import com.liferay.portal.kernel.model.CacheModel;
import com.liferay.portal.kernel.model.Country;
import com.liferay.portal.kernel.model.CountryLocalization;
import com.liferay.portal.kernel.model.CountryModel;
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.CountryLocalServiceUtil;
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.LocalizationUtil;
import com.liferay.portal.kernel.util.PortalUtil;
import com.liferay.portal.kernel.util.ProxyUtil;
import com.liferay.portal.kernel.util.StringUtil;

import java.io.Serializable;

import java.lang.reflect.InvocationHandler;

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.List;
import java.util.Map;
import java.util.Objects;
import java.util.function.BiConsumer;
import java.util.function.Function;

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

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

* * @author Brian Wing Shun Chan * @see CountryImpl * @generated */ @JSON(strict = true) public class CountryModelImpl extends BaseModelImpl implements CountryModel { /* * NOTE FOR DEVELOPERS: * * Never modify or reference this class directly. All methods that expect a country model instance should use the Country interface instead. */ public static final String TABLE_NAME = "Country"; public static final Object[][] TABLE_COLUMNS = { {"mvccVersion", Types.BIGINT}, {"uuid_", Types.VARCHAR}, {"defaultLanguageId", Types.VARCHAR}, {"countryId", Types.BIGINT}, {"companyId", Types.BIGINT}, {"userId", Types.BIGINT}, {"userName", Types.VARCHAR}, {"createDate", Types.TIMESTAMP}, {"modifiedDate", Types.TIMESTAMP}, {"a2", Types.VARCHAR}, {"a3", Types.VARCHAR}, {"active_", Types.BOOLEAN}, {"billingAllowed", Types.BOOLEAN}, {"groupFilterEnabled", Types.BOOLEAN}, {"idd_", Types.VARCHAR}, {"name", Types.VARCHAR}, {"number_", Types.VARCHAR}, {"position", Types.DOUBLE}, {"shippingAllowed", Types.BOOLEAN}, {"subjectToVAT", Types.BOOLEAN}, {"zipRequired", Types.BOOLEAN}, {"lastPublishDate", Types.TIMESTAMP} }; public static final Map TABLE_COLUMNS_MAP = new HashMap(); static { TABLE_COLUMNS_MAP.put("mvccVersion", Types.BIGINT); TABLE_COLUMNS_MAP.put("uuid_", Types.VARCHAR); TABLE_COLUMNS_MAP.put("defaultLanguageId", Types.VARCHAR); TABLE_COLUMNS_MAP.put("countryId", 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("a2", Types.VARCHAR); TABLE_COLUMNS_MAP.put("a3", Types.VARCHAR); TABLE_COLUMNS_MAP.put("active_", Types.BOOLEAN); TABLE_COLUMNS_MAP.put("billingAllowed", Types.BOOLEAN); TABLE_COLUMNS_MAP.put("groupFilterEnabled", Types.BOOLEAN); TABLE_COLUMNS_MAP.put("idd_", Types.VARCHAR); TABLE_COLUMNS_MAP.put("name", Types.VARCHAR); TABLE_COLUMNS_MAP.put("number_", Types.VARCHAR); TABLE_COLUMNS_MAP.put("position", Types.DOUBLE); TABLE_COLUMNS_MAP.put("shippingAllowed", Types.BOOLEAN); TABLE_COLUMNS_MAP.put("subjectToVAT", Types.BOOLEAN); TABLE_COLUMNS_MAP.put("zipRequired", Types.BOOLEAN); TABLE_COLUMNS_MAP.put("lastPublishDate", Types.TIMESTAMP); } public static final String TABLE_SQL_CREATE = "create table Country (mvccVersion LONG default 0 not null,uuid_ VARCHAR(75) null,defaultLanguageId VARCHAR(75) null,countryId LONG not null primary key,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,a2 VARCHAR(75) null,a3 VARCHAR(75) null,active_ BOOLEAN,billingAllowed BOOLEAN,groupFilterEnabled BOOLEAN,idd_ VARCHAR(75) null,name VARCHAR(75) null,number_ VARCHAR(75) null,position DOUBLE,shippingAllowed BOOLEAN,subjectToVAT BOOLEAN,zipRequired BOOLEAN,lastPublishDate DATE null)"; public static final String TABLE_SQL_DROP = "drop table Country"; public static final String ORDER_BY_JPQL = " ORDER BY country.name ASC"; public static final String ORDER_BY_SQL = " ORDER BY Country.name 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), with no direct replacement */ @Deprecated public static final boolean ENTITY_CACHE_ENABLED = true; /** * @deprecated As of Athanasius (7.3.x), with no direct replacement */ @Deprecated public static final boolean FINDER_CACHE_ENABLED = true; /** * @deprecated As of Athanasius (7.3.x), with no direct replacement */ @Deprecated public static final boolean COLUMN_BITMASK_ENABLED = true; /** * @deprecated As of Athanasius (7.3.x), replaced by {@link #getColumnBitmask(String)} */ @Deprecated public static final long A2_COLUMN_BITMASK = 1L; /** * @deprecated As of Athanasius (7.3.x), replaced by {@link #getColumnBitmask(String)} */ @Deprecated public static final long A3_COLUMN_BITMASK = 2L; /** * @deprecated As of Athanasius (7.3.x), replaced by {@link #getColumnBitmask(String)} */ @Deprecated public static final long ACTIVE_COLUMN_BITMASK = 4L; /** * @deprecated As of Athanasius (7.3.x), replaced by {@link #getColumnBitmask(String)} */ @Deprecated public static final long BILLINGALLOWED_COLUMN_BITMASK = 8L; /** * @deprecated As of Athanasius (7.3.x), replaced by {@link #getColumnBitmask(String)} */ @Deprecated public static final long COMPANYID_COLUMN_BITMASK = 16L; /** * @deprecated As of Athanasius (7.3.x), replaced by {@link #getColumnBitmask(String)} */ @Deprecated public static final long NAME_COLUMN_BITMASK = 32L; /** * @deprecated As of Athanasius (7.3.x), replaced by {@link #getColumnBitmask(String)} */ @Deprecated public static final long NUMBER_COLUMN_BITMASK = 64L; /** * @deprecated As of Athanasius (7.3.x), replaced by {@link #getColumnBitmask(String)} */ @Deprecated public static final long SHIPPINGALLOWED_COLUMN_BITMASK = 128L; /** * @deprecated As of Athanasius (7.3.x), replaced by {@link #getColumnBitmask(String)} */ @Deprecated public static final long UUID_COLUMN_BITMASK = 256L; public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong( com.liferay.portal.util.PropsUtil.get( "lock.expiration.time.com.liferay.portal.kernel.model.Country")); public CountryModelImpl() { } @Override public long getPrimaryKey() { return _countryId; } @Override public void setPrimaryKey(long primaryKey) { setCountryId(primaryKey); } @Override public Serializable getPrimaryKeyObj() { return _countryId; } @Override public void setPrimaryKeyObj(Serializable primaryKeyObj) { setPrimaryKey(((Long)primaryKeyObj).longValue()); } @Override public Class getModelClass() { return Country.class; } @Override public String getModelClassName() { return Country.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((Country)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( (Country)this, entry.getValue()); } } } public Map> getAttributeGetterFunctions() { return _attributeGetterFunctions; } public Map> getAttributeSetterBiConsumers() { return _attributeSetterBiConsumers; } private static final Map> _attributeGetterFunctions; private static final Map> _attributeSetterBiConsumers; static { Map> attributeGetterFunctions = new LinkedHashMap>(); Map> attributeSetterBiConsumers = new LinkedHashMap>(); attributeGetterFunctions.put("mvccVersion", Country::getMvccVersion); attributeSetterBiConsumers.put( "mvccVersion", (BiConsumer)Country::setMvccVersion); attributeGetterFunctions.put("uuid", Country::getUuid); attributeSetterBiConsumers.put( "uuid", (BiConsumer)Country::setUuid); attributeGetterFunctions.put( "defaultLanguageId", Country::getDefaultLanguageId); attributeSetterBiConsumers.put( "defaultLanguageId", (BiConsumer)Country::setDefaultLanguageId); attributeGetterFunctions.put("countryId", Country::getCountryId); attributeSetterBiConsumers.put( "countryId", (BiConsumer)Country::setCountryId); attributeGetterFunctions.put("companyId", Country::getCompanyId); attributeSetterBiConsumers.put( "companyId", (BiConsumer)Country::setCompanyId); attributeGetterFunctions.put("userId", Country::getUserId); attributeSetterBiConsumers.put( "userId", (BiConsumer)Country::setUserId); attributeGetterFunctions.put("userName", Country::getUserName); attributeSetterBiConsumers.put( "userName", (BiConsumer)Country::setUserName); attributeGetterFunctions.put("createDate", Country::getCreateDate); attributeSetterBiConsumers.put( "createDate", (BiConsumer)Country::setCreateDate); attributeGetterFunctions.put("modifiedDate", Country::getModifiedDate); attributeSetterBiConsumers.put( "modifiedDate", (BiConsumer)Country::setModifiedDate); attributeGetterFunctions.put("a2", Country::getA2); attributeSetterBiConsumers.put( "a2", (BiConsumer)Country::setA2); attributeGetterFunctions.put("a3", Country::getA3); attributeSetterBiConsumers.put( "a3", (BiConsumer)Country::setA3); attributeGetterFunctions.put("active", Country::getActive); attributeSetterBiConsumers.put( "active", (BiConsumer)Country::setActive); attributeGetterFunctions.put( "billingAllowed", Country::getBillingAllowed); attributeSetterBiConsumers.put( "billingAllowed", (BiConsumer)Country::setBillingAllowed); attributeGetterFunctions.put( "groupFilterEnabled", Country::getGroupFilterEnabled); attributeSetterBiConsumers.put( "groupFilterEnabled", (BiConsumer)Country::setGroupFilterEnabled); attributeGetterFunctions.put("idd", Country::getIdd); attributeSetterBiConsumers.put( "idd", (BiConsumer)Country::setIdd); attributeGetterFunctions.put("name", Country::getName); attributeSetterBiConsumers.put( "name", (BiConsumer)Country::setName); attributeGetterFunctions.put("number", Country::getNumber); attributeSetterBiConsumers.put( "number", (BiConsumer)Country::setNumber); attributeGetterFunctions.put("position", Country::getPosition); attributeSetterBiConsumers.put( "position", (BiConsumer)Country::setPosition); attributeGetterFunctions.put( "shippingAllowed", Country::getShippingAllowed); attributeSetterBiConsumers.put( "shippingAllowed", (BiConsumer)Country::setShippingAllowed); attributeGetterFunctions.put("subjectToVAT", Country::getSubjectToVAT); attributeSetterBiConsumers.put( "subjectToVAT", (BiConsumer)Country::setSubjectToVAT); attributeGetterFunctions.put("zipRequired", Country::getZipRequired); attributeSetterBiConsumers.put( "zipRequired", (BiConsumer)Country::setZipRequired); attributeGetterFunctions.put( "lastPublishDate", Country::getLastPublishDate); attributeSetterBiConsumers.put( "lastPublishDate", (BiConsumer)Country::setLastPublishDate); _attributeGetterFunctions = Collections.unmodifiableMap( attributeGetterFunctions); _attributeSetterBiConsumers = Collections.unmodifiableMap( (Map)attributeSetterBiConsumers); } @Override public String[] getAvailableLanguageIds() { List countryLocalizations = CountryLocalServiceUtil.getCountryLocalizations(getPrimaryKey()); String[] availableLanguageIds = new String[countryLocalizations.size()]; for (int i = 0; i < availableLanguageIds.length; i++) { CountryLocalization countryLocalization = countryLocalizations.get( i); availableLanguageIds[i] = countryLocalization.getLanguageId(); } return availableLanguageIds; } @Override public String getTitle() { return getTitle(getDefaultLanguageId(), false); } @Override public String getTitle(String languageId) { return getTitle(languageId, true); } @Override public String getTitle(String languageId, boolean useDefault) { if (useDefault) { return LocalizationUtil.getLocalization( new Function() { @Override public String apply(String languageId) { return _getTitle(languageId); } }, languageId, getDefaultLanguageId()); } return _getTitle(languageId); } @Override public String getTitleMapAsXML() { return LocalizationUtil.getXml( getLanguageIdToTitleMap(), getDefaultLanguageId(), "Title"); } @Override public Map getLanguageIdToTitleMap() { Map languageIdToTitleMap = new HashMap(); List countryLocalizations = CountryLocalServiceUtil.getCountryLocalizations(getPrimaryKey()); for (CountryLocalization countryLocalization : countryLocalizations) { languageIdToTitleMap.put( countryLocalization.getLanguageId(), countryLocalization.getTitle()); } return languageIdToTitleMap; } private String _getTitle(String languageId) { CountryLocalization countryLocalization = CountryLocalServiceUtil.fetchCountryLocalization( getPrimaryKey(), languageId); if (countryLocalization == null) { return ""; } return countryLocalization.getTitle(); } @JSON @Override public long getMvccVersion() { return _mvccVersion; } @Override public void setMvccVersion(long mvccVersion) { if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } _mvccVersion = mvccVersion; } @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 String getDefaultLanguageId() { if (_defaultLanguageId == null) { return ""; } else { return _defaultLanguageId; } } @Override public void setDefaultLanguageId(String defaultLanguageId) { if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } _defaultLanguageId = defaultLanguageId; } @JSON @Override public long getCountryId() { return _countryId; } @Override public void setCountryId(long countryId) { if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } _countryId = countryId; } @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 String getA2() { if (_a2 == null) { return ""; } else { return _a2; } } @Override public void setA2(String a2) { if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } _a2 = a2; } /** * @deprecated As of Athanasius (7.3.x), replaced by {@link * #getColumnOriginalValue(String)} */ @Deprecated public String getOriginalA2() { return getColumnOriginalValue("a2"); } @JSON @Override public String getA3() { if (_a3 == null) { return ""; } else { return _a3; } } @Override public void setA3(String a3) { if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } _a3 = a3; } /** * @deprecated As of Athanasius (7.3.x), replaced by {@link * #getColumnOriginalValue(String)} */ @Deprecated public String getOriginalA3() { return getColumnOriginalValue("a3"); } @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 boolean getBillingAllowed() { return _billingAllowed; } @JSON @Override public boolean isBillingAllowed() { return _billingAllowed; } @Override public void setBillingAllowed(boolean billingAllowed) { if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } _billingAllowed = billingAllowed; } /** * @deprecated As of Athanasius (7.3.x), replaced by {@link * #getColumnOriginalValue(String)} */ @Deprecated public boolean getOriginalBillingAllowed() { return GetterUtil.getBoolean( this.getColumnOriginalValue("billingAllowed")); } @JSON @Override public boolean getGroupFilterEnabled() { return _groupFilterEnabled; } @JSON @Override public boolean isGroupFilterEnabled() { return _groupFilterEnabled; } @Override public void setGroupFilterEnabled(boolean groupFilterEnabled) { if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } _groupFilterEnabled = groupFilterEnabled; } @JSON @Override public String getIdd() { if (_idd == null) { return ""; } else { return _idd; } } @Override public void setIdd(String idd) { if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } _idd = idd; } @JSON @Override public String getName() { if (_name == null) { return ""; } else { return _name; } } @Override public void setName(String name) { if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } _name = name; } /** * @deprecated As of Athanasius (7.3.x), replaced by {@link * #getColumnOriginalValue(String)} */ @Deprecated public String getOriginalName() { return getColumnOriginalValue("name"); } @JSON @Override public String getNumber() { if (_number == null) { return ""; } else { return _number; } } @Override public void setNumber(String number) { if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } _number = number; } /** * @deprecated As of Athanasius (7.3.x), replaced by {@link * #getColumnOriginalValue(String)} */ @Deprecated public String getOriginalNumber() { return getColumnOriginalValue("number_"); } @JSON @Override public double getPosition() { return _position; } @Override public void setPosition(double position) { if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } _position = position; } @JSON @Override public boolean getShippingAllowed() { return _shippingAllowed; } @JSON @Override public boolean isShippingAllowed() { return _shippingAllowed; } @Override public void setShippingAllowed(boolean shippingAllowed) { if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } _shippingAllowed = shippingAllowed; } /** * @deprecated As of Athanasius (7.3.x), replaced by {@link * #getColumnOriginalValue(String)} */ @Deprecated public boolean getOriginalShippingAllowed() { return GetterUtil.getBoolean( this.getColumnOriginalValue("shippingAllowed")); } @JSON @Override public boolean getSubjectToVAT() { return _subjectToVAT; } @JSON @Override public boolean isSubjectToVAT() { return _subjectToVAT; } @Override public void setSubjectToVAT(boolean subjectToVAT) { if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } _subjectToVAT = subjectToVAT; } @JSON @Override public boolean getZipRequired() { return _zipRequired; } @JSON @Override public boolean isZipRequired() { return _zipRequired; } @Override public void setZipRequired(boolean zipRequired) { if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } _zipRequired = zipRequired; } @JSON @Override public Date getLastPublishDate() { return _lastPublishDate; } @Override public void setLastPublishDate(Date lastPublishDate) { if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } _lastPublishDate = lastPublishDate; } @Override public StagedModelType getStagedModelType() { return new StagedModelType( PortalUtil.getClassNameId(Country.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(), Country.class.getName(), getPrimaryKey()); } @Override public void setExpandoBridgeAttributes(ServiceContext serviceContext) { ExpandoBridge expandoBridge = getExpandoBridge(); expandoBridge.setAttributes(serviceContext); } @Override public Country toEscapedModel() { if (_escapedModel == null) { Function escapedModelProxyProviderFunction = EscapedModelProxyProviderFunctionHolder. _escapedModelProxyProviderFunction; _escapedModel = escapedModelProxyProviderFunction.apply( new AutoEscapeBeanHandler(this)); } return _escapedModel; } @Override public Object clone() { CountryImpl countryImpl = new CountryImpl(); countryImpl.setMvccVersion(getMvccVersion()); countryImpl.setUuid(getUuid()); countryImpl.setDefaultLanguageId(getDefaultLanguageId()); countryImpl.setCountryId(getCountryId()); countryImpl.setCompanyId(getCompanyId()); countryImpl.setUserId(getUserId()); countryImpl.setUserName(getUserName()); countryImpl.setCreateDate(getCreateDate()); countryImpl.setModifiedDate(getModifiedDate()); countryImpl.setA2(getA2()); countryImpl.setA3(getA3()); countryImpl.setActive(isActive()); countryImpl.setBillingAllowed(isBillingAllowed()); countryImpl.setGroupFilterEnabled(isGroupFilterEnabled()); countryImpl.setIdd(getIdd()); countryImpl.setName(getName()); countryImpl.setNumber(getNumber()); countryImpl.setPosition(getPosition()); countryImpl.setShippingAllowed(isShippingAllowed()); countryImpl.setSubjectToVAT(isSubjectToVAT()); countryImpl.setZipRequired(isZipRequired()); countryImpl.setLastPublishDate(getLastPublishDate()); countryImpl.resetOriginalValues(); return countryImpl; } @Override public Country cloneWithOriginalValues() { CountryImpl countryImpl = new CountryImpl(); countryImpl.setMvccVersion( this.getColumnOriginalValue("mvccVersion")); countryImpl.setUuid(this.getColumnOriginalValue("uuid_")); countryImpl.setDefaultLanguageId( this.getColumnOriginalValue("defaultLanguageId")); countryImpl.setCountryId( this.getColumnOriginalValue("countryId")); countryImpl.setCompanyId( this.getColumnOriginalValue("companyId")); countryImpl.setUserId(this.getColumnOriginalValue("userId")); countryImpl.setUserName( this.getColumnOriginalValue("userName")); countryImpl.setCreateDate( this.getColumnOriginalValue("createDate")); countryImpl.setModifiedDate( this.getColumnOriginalValue("modifiedDate")); countryImpl.setA2(this.getColumnOriginalValue("a2")); countryImpl.setA3(this.getColumnOriginalValue("a3")); countryImpl.setActive(this.getColumnOriginalValue("active_")); countryImpl.setBillingAllowed( this.getColumnOriginalValue("billingAllowed")); countryImpl.setGroupFilterEnabled( this.getColumnOriginalValue("groupFilterEnabled")); countryImpl.setIdd(this.getColumnOriginalValue("idd_")); countryImpl.setName(this.getColumnOriginalValue("name")); countryImpl.setNumber(this.getColumnOriginalValue("number_")); countryImpl.setPosition( this.getColumnOriginalValue("position")); countryImpl.setShippingAllowed( this.getColumnOriginalValue("shippingAllowed")); countryImpl.setSubjectToVAT( this.getColumnOriginalValue("subjectToVAT")); countryImpl.setZipRequired( this.getColumnOriginalValue("zipRequired")); countryImpl.setLastPublishDate( this.getColumnOriginalValue("lastPublishDate")); return countryImpl; } @Override public int compareTo(Country country) { int value = 0; value = getName().compareTo(country.getName()); if (value != 0) { return value; } return 0; } @Override public boolean equals(Object object) { if (this == object) { return true; } if (!(object instanceof Country)) { return false; } Country country = (Country)object; long primaryKey = country.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 ENTITY_CACHE_ENABLED; } /** * @deprecated As of Athanasius (7.3.x), with no direct replacement */ @Deprecated @Override public boolean isFinderCacheEnabled() { return FINDER_CACHE_ENABLED; } @Override public void resetOriginalValues() { _columnOriginalValues = Collections.emptyMap(); _setModifiedDate = false; _columnBitmask = 0; } @Override public CacheModel toCacheModel() { CountryCacheModel countryCacheModel = new CountryCacheModel(); countryCacheModel.mvccVersion = getMvccVersion(); countryCacheModel.uuid = getUuid(); String uuid = countryCacheModel.uuid; if ((uuid != null) && (uuid.length() == 0)) { countryCacheModel.uuid = null; } countryCacheModel.defaultLanguageId = getDefaultLanguageId(); String defaultLanguageId = countryCacheModel.defaultLanguageId; if ((defaultLanguageId != null) && (defaultLanguageId.length() == 0)) { countryCacheModel.defaultLanguageId = null; } countryCacheModel.countryId = getCountryId(); countryCacheModel.companyId = getCompanyId(); countryCacheModel.userId = getUserId(); countryCacheModel.userName = getUserName(); String userName = countryCacheModel.userName; if ((userName != null) && (userName.length() == 0)) { countryCacheModel.userName = null; } Date createDate = getCreateDate(); if (createDate != null) { countryCacheModel.createDate = createDate.getTime(); } else { countryCacheModel.createDate = Long.MIN_VALUE; } Date modifiedDate = getModifiedDate(); if (modifiedDate != null) { countryCacheModel.modifiedDate = modifiedDate.getTime(); } else { countryCacheModel.modifiedDate = Long.MIN_VALUE; } countryCacheModel.a2 = getA2(); String a2 = countryCacheModel.a2; if ((a2 != null) && (a2.length() == 0)) { countryCacheModel.a2 = null; } countryCacheModel.a3 = getA3(); String a3 = countryCacheModel.a3; if ((a3 != null) && (a3.length() == 0)) { countryCacheModel.a3 = null; } countryCacheModel.active = isActive(); countryCacheModel.billingAllowed = isBillingAllowed(); countryCacheModel.groupFilterEnabled = isGroupFilterEnabled(); countryCacheModel.idd = getIdd(); String idd = countryCacheModel.idd; if ((idd != null) && (idd.length() == 0)) { countryCacheModel.idd = null; } countryCacheModel.name = getName(); String name = countryCacheModel.name; if ((name != null) && (name.length() == 0)) { countryCacheModel.name = null; } countryCacheModel.number = getNumber(); String number = countryCacheModel.number; if ((number != null) && (number.length() == 0)) { countryCacheModel.number = null; } countryCacheModel.position = getPosition(); countryCacheModel.shippingAllowed = isShippingAllowed(); countryCacheModel.subjectToVAT = isSubjectToVAT(); countryCacheModel.zipRequired = isZipRequired(); Date lastPublishDate = getLastPublishDate(); if (lastPublishDate != null) { countryCacheModel.lastPublishDate = lastPublishDate.getTime(); } else { countryCacheModel.lastPublishDate = Long.MIN_VALUE; } return countryCacheModel; } @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((Country)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( Country.class, ModelWrapper.class); } private long _mvccVersion; private String _uuid; private String _defaultLanguageId; private long _countryId; private long _companyId; private long _userId; private String _userName; private Date _createDate; private Date _modifiedDate; private boolean _setModifiedDate; private String _a2; private String _a3; private boolean _active; private boolean _billingAllowed; private boolean _groupFilterEnabled; private String _idd; private String _name; private String _number; private double _position; private boolean _shippingAllowed; private boolean _subjectToVAT; private boolean _zipRequired; private Date _lastPublishDate; public T getColumnValue(String columnName) { columnName = _attributeNames.getOrDefault(columnName, columnName); Function function = _attributeGetterFunctions.get( columnName); if (function == null) { throw new IllegalArgumentException( "No attribute getter function found for " + columnName); } return (T)function.apply((Country)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("uuid_", _uuid); _columnOriginalValues.put("defaultLanguageId", _defaultLanguageId); _columnOriginalValues.put("countryId", _countryId); _columnOriginalValues.put("companyId", _companyId); _columnOriginalValues.put("userId", _userId); _columnOriginalValues.put("userName", _userName); _columnOriginalValues.put("createDate", _createDate); _columnOriginalValues.put("modifiedDate", _modifiedDate); _columnOriginalValues.put("a2", _a2); _columnOriginalValues.put("a3", _a3); _columnOriginalValues.put("active_", _active); _columnOriginalValues.put("billingAllowed", _billingAllowed); _columnOriginalValues.put("groupFilterEnabled", _groupFilterEnabled); _columnOriginalValues.put("idd_", _idd); _columnOriginalValues.put("name", _name); _columnOriginalValues.put("number_", _number); _columnOriginalValues.put("position", _position); _columnOriginalValues.put("shippingAllowed", _shippingAllowed); _columnOriginalValues.put("subjectToVAT", _subjectToVAT); _columnOriginalValues.put("zipRequired", _zipRequired); _columnOriginalValues.put("lastPublishDate", _lastPublishDate); } private static final Map _attributeNames; static { Map attributeNames = new HashMap<>(); attributeNames.put("uuid_", "uuid"); attributeNames.put("active_", "active"); attributeNames.put("idd_", "idd"); attributeNames.put("number_", "number"); _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("uuid_", 2L); columnBitmasks.put("defaultLanguageId", 4L); columnBitmasks.put("countryId", 8L); columnBitmasks.put("companyId", 16L); columnBitmasks.put("userId", 32L); columnBitmasks.put("userName", 64L); columnBitmasks.put("createDate", 128L); columnBitmasks.put("modifiedDate", 256L); columnBitmasks.put("a2", 512L); columnBitmasks.put("a3", 1024L); columnBitmasks.put("active_", 2048L); columnBitmasks.put("billingAllowed", 4096L); columnBitmasks.put("groupFilterEnabled", 8192L); columnBitmasks.put("idd_", 16384L); columnBitmasks.put("name", 32768L); columnBitmasks.put("number_", 65536L); columnBitmasks.put("position", 131072L); columnBitmasks.put("shippingAllowed", 262144L); columnBitmasks.put("subjectToVAT", 524288L); columnBitmasks.put("zipRequired", 1048576L); columnBitmasks.put("lastPublishDate", 2097152L); _columnBitmasks = Collections.unmodifiableMap(columnBitmasks); } private long _columnBitmask; private Country _escapedModel; }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy