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

com.liferay.oauth2.provider.model.impl.OAuth2ScopeGrantModelImpl Maven / Gradle / Ivy

There is a newer version: 4.0.94
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.oauth2.provider.model.impl;

import com.liferay.expando.kernel.model.ExpandoBridge;
import com.liferay.expando.kernel.util.ExpandoBridgeFactoryUtil;
import com.liferay.oauth2.provider.model.OAuth2ScopeGrant;
import com.liferay.oauth2.provider.model.OAuth2ScopeGrantModel;
import com.liferay.petra.string.StringBundler;
import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.model.CacheModel;
import com.liferay.portal.kernel.model.ModelWrapper;
import com.liferay.portal.kernel.model.impl.BaseModelImpl;
import com.liferay.portal.kernel.service.ServiceContext;
import com.liferay.portal.kernel.util.GetterUtil;
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.Map;
import java.util.Objects;
import java.util.function.BiConsumer;
import java.util.function.Function;

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

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

* * @author Brian Wing Shun Chan * @see OAuth2ScopeGrantImpl * @generated */ public class OAuth2ScopeGrantModelImpl extends BaseModelImpl implements OAuth2ScopeGrantModel { /* * NOTE FOR DEVELOPERS: * * Never modify or reference this class directly. All methods that expect a o auth2 scope grant model instance should use the OAuth2ScopeGrant interface instead. */ public static final String TABLE_NAME = "OAuth2ScopeGrant"; public static final Object[][] TABLE_COLUMNS = { {"oAuth2ScopeGrantId", Types.BIGINT}, {"companyId", Types.BIGINT}, {"oA2AScopeAliasesId", Types.BIGINT}, {"applicationName", Types.VARCHAR}, {"bundleSymbolicName", Types.VARCHAR}, {"scope", Types.VARCHAR}, {"scopeAliases", Types.CLOB} }; public static final Map TABLE_COLUMNS_MAP = new HashMap(); static { TABLE_COLUMNS_MAP.put("oAuth2ScopeGrantId", Types.BIGINT); TABLE_COLUMNS_MAP.put("companyId", Types.BIGINT); TABLE_COLUMNS_MAP.put("oA2AScopeAliasesId", Types.BIGINT); TABLE_COLUMNS_MAP.put("applicationName", Types.VARCHAR); TABLE_COLUMNS_MAP.put("bundleSymbolicName", Types.VARCHAR); TABLE_COLUMNS_MAP.put("scope", Types.VARCHAR); TABLE_COLUMNS_MAP.put("scopeAliases", Types.CLOB); } public static final String TABLE_SQL_CREATE = "create table OAuth2ScopeGrant (oAuth2ScopeGrantId LONG not null primary key,companyId LONG,oA2AScopeAliasesId LONG,applicationName VARCHAR(255) null,bundleSymbolicName VARCHAR(255) null,scope VARCHAR(240) null,scopeAliases TEXT null)"; public static final String TABLE_SQL_DROP = "drop table OAuth2ScopeGrant"; public static final String ORDER_BY_JPQL = " ORDER BY oAuth2ScopeGrant.oAuth2ScopeGrantId ASC"; public static final String ORDER_BY_SQL = " ORDER BY OAuth2ScopeGrant.oAuth2ScopeGrantId 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 APPLICATIONNAME_COLUMN_BITMASK = 1L; /** * @deprecated As of Athanasius (7.3.x), replaced by {@link #getColumnBitmask(String)} */ @Deprecated public static final long BUNDLESYMBOLICNAME_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 OAUTH2APPLICATIONSCOPEALIASESID_COLUMN_BITMASK = 8L; /** * @deprecated As of Athanasius (7.3.x), replaced by {@link #getColumnBitmask(String)} */ @Deprecated public static final long SCOPE_COLUMN_BITMASK = 16L; /** * @deprecated As of Athanasius (7.3.x), replaced by {@link * #getColumnBitmask(String)} */ @Deprecated public static final long OAUTH2SCOPEGRANTID_COLUMN_BITMASK = 32L; /** * @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 static final String MAPPING_TABLE_OA2AUTHS_OA2SCOPEGRANTS_NAME = "OA2Auths_OA2ScopeGrants"; public static final Object[][] MAPPING_TABLE_OA2AUTHS_OA2SCOPEGRANTS_COLUMNS = { {"companyId", Types.BIGINT}, {"oAuth2AuthorizationId", Types.BIGINT}, {"oAuth2ScopeGrantId", Types.BIGINT} }; public static final String MAPPING_TABLE_OA2AUTHS_OA2SCOPEGRANTS_SQL_CREATE = "create table OA2Auths_OA2ScopeGrants (companyId LONG not null,oAuth2AuthorizationId LONG not null,oAuth2ScopeGrantId LONG not null,primary key (oAuth2AuthorizationId, oAuth2ScopeGrantId))"; public OAuth2ScopeGrantModelImpl() { } @Override public long getPrimaryKey() { return _oAuth2ScopeGrantId; } @Override public void setPrimaryKey(long primaryKey) { setOAuth2ScopeGrantId(primaryKey); } @Override public Serializable getPrimaryKeyObj() { return _oAuth2ScopeGrantId; } @Override public void setPrimaryKeyObj(Serializable primaryKeyObj) { setPrimaryKey(((Long)primaryKeyObj).longValue()); } @Override public Class getModelClass() { return OAuth2ScopeGrant.class; } @Override public String getModelClassName() { return OAuth2ScopeGrant.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((OAuth2ScopeGrant)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( (OAuth2ScopeGrant)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( "oAuth2ScopeGrantId", OAuth2ScopeGrant::getOAuth2ScopeGrantId); attributeGetterFunctions.put( "companyId", OAuth2ScopeGrant::getCompanyId); attributeGetterFunctions.put( "oAuth2ApplicationScopeAliasesId", OAuth2ScopeGrant::getOAuth2ApplicationScopeAliasesId); attributeGetterFunctions.put( "applicationName", OAuth2ScopeGrant::getApplicationName); attributeGetterFunctions.put( "bundleSymbolicName", OAuth2ScopeGrant::getBundleSymbolicName); attributeGetterFunctions.put("scope", OAuth2ScopeGrant::getScope); attributeGetterFunctions.put( "scopeAliases", OAuth2ScopeGrant::getScopeAliases); _attributeGetterFunctions = Collections.unmodifiableMap( attributeGetterFunctions); } } private static class AttributeSetterBiConsumersHolder { private static final Map> _attributeSetterBiConsumers; static { Map> attributeSetterBiConsumers = new LinkedHashMap >(); attributeSetterBiConsumers.put( "oAuth2ScopeGrantId", (BiConsumer) OAuth2ScopeGrant::setOAuth2ScopeGrantId); attributeSetterBiConsumers.put( "companyId", (BiConsumer) OAuth2ScopeGrant::setCompanyId); attributeSetterBiConsumers.put( "oAuth2ApplicationScopeAliasesId", (BiConsumer) OAuth2ScopeGrant::setOAuth2ApplicationScopeAliasesId); attributeSetterBiConsumers.put( "applicationName", (BiConsumer) OAuth2ScopeGrant::setApplicationName); attributeSetterBiConsumers.put( "bundleSymbolicName", (BiConsumer) OAuth2ScopeGrant::setBundleSymbolicName); attributeSetterBiConsumers.put( "scope", (BiConsumer) OAuth2ScopeGrant::setScope); attributeSetterBiConsumers.put( "scopeAliases", (BiConsumer) OAuth2ScopeGrant::setScopeAliases); _attributeSetterBiConsumers = Collections.unmodifiableMap( (Map)attributeSetterBiConsumers); } } @Override public long getOAuth2ScopeGrantId() { return _oAuth2ScopeGrantId; } @Override public void setOAuth2ScopeGrantId(long oAuth2ScopeGrantId) { if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } _oAuth2ScopeGrantId = oAuth2ScopeGrantId; } @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")); } @Override public long getOAuth2ApplicationScopeAliasesId() { return _oAuth2ApplicationScopeAliasesId; } @Override public void setOAuth2ApplicationScopeAliasesId( long oAuth2ApplicationScopeAliasesId) { if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } _oAuth2ApplicationScopeAliasesId = oAuth2ApplicationScopeAliasesId; } /** * @deprecated As of Athanasius (7.3.x), replaced by {@link * #getColumnOriginalValue(String)} */ @Deprecated public long getOriginalOAuth2ApplicationScopeAliasesId() { return GetterUtil.getLong( this.getColumnOriginalValue("oA2AScopeAliasesId")); } @Override public String getApplicationName() { if (_applicationName == null) { return ""; } else { return _applicationName; } } @Override public void setApplicationName(String applicationName) { if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } _applicationName = applicationName; } /** * @deprecated As of Athanasius (7.3.x), replaced by {@link * #getColumnOriginalValue(String)} */ @Deprecated public String getOriginalApplicationName() { return getColumnOriginalValue("applicationName"); } @Override public String getBundleSymbolicName() { if (_bundleSymbolicName == null) { return ""; } else { return _bundleSymbolicName; } } @Override public void setBundleSymbolicName(String bundleSymbolicName) { if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } _bundleSymbolicName = bundleSymbolicName; } /** * @deprecated As of Athanasius (7.3.x), replaced by {@link * #getColumnOriginalValue(String)} */ @Deprecated public String getOriginalBundleSymbolicName() { return getColumnOriginalValue("bundleSymbolicName"); } @Override public String getScope() { if (_scope == null) { return ""; } else { return _scope; } } @Override public void setScope(String scope) { if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } _scope = scope; } /** * @deprecated As of Athanasius (7.3.x), replaced by {@link * #getColumnOriginalValue(String)} */ @Deprecated public String getOriginalScope() { return getColumnOriginalValue("scope"); } @Override public String getScopeAliases() { if (_scopeAliases == null) { return ""; } else { return _scopeAliases; } } @Override public void setScopeAliases(String scopeAliases) { if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } _scopeAliases = scopeAliases; } 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(), OAuth2ScopeGrant.class.getName(), getPrimaryKey()); } @Override public void setExpandoBridgeAttributes(ServiceContext serviceContext) { ExpandoBridge expandoBridge = getExpandoBridge(); expandoBridge.setAttributes(serviceContext); } @Override public OAuth2ScopeGrant toEscapedModel() { if (_escapedModel == null) { Function escapedModelProxyProviderFunction = EscapedModelProxyProviderFunctionHolder. _escapedModelProxyProviderFunction; _escapedModel = escapedModelProxyProviderFunction.apply( new AutoEscapeBeanHandler(this)); } return _escapedModel; } @Override public Object clone() { OAuth2ScopeGrantImpl oAuth2ScopeGrantImpl = new OAuth2ScopeGrantImpl(); oAuth2ScopeGrantImpl.setOAuth2ScopeGrantId(getOAuth2ScopeGrantId()); oAuth2ScopeGrantImpl.setCompanyId(getCompanyId()); oAuth2ScopeGrantImpl.setOAuth2ApplicationScopeAliasesId( getOAuth2ApplicationScopeAliasesId()); oAuth2ScopeGrantImpl.setApplicationName(getApplicationName()); oAuth2ScopeGrantImpl.setBundleSymbolicName(getBundleSymbolicName()); oAuth2ScopeGrantImpl.setScope(getScope()); oAuth2ScopeGrantImpl.setScopeAliases(getScopeAliases()); oAuth2ScopeGrantImpl.resetOriginalValues(); return oAuth2ScopeGrantImpl; } @Override public OAuth2ScopeGrant cloneWithOriginalValues() { OAuth2ScopeGrantImpl oAuth2ScopeGrantImpl = new OAuth2ScopeGrantImpl(); oAuth2ScopeGrantImpl.setOAuth2ScopeGrantId( this.getColumnOriginalValue("oAuth2ScopeGrantId")); oAuth2ScopeGrantImpl.setCompanyId( this.getColumnOriginalValue("companyId")); oAuth2ScopeGrantImpl.setOAuth2ApplicationScopeAliasesId( this.getColumnOriginalValue("oA2AScopeAliasesId")); oAuth2ScopeGrantImpl.setApplicationName( this.getColumnOriginalValue("applicationName")); oAuth2ScopeGrantImpl.setBundleSymbolicName( this.getColumnOriginalValue("bundleSymbolicName")); oAuth2ScopeGrantImpl.setScope( this.getColumnOriginalValue("scope")); oAuth2ScopeGrantImpl.setScopeAliases( this.getColumnOriginalValue("scopeAliases")); return oAuth2ScopeGrantImpl; } @Override public int compareTo(OAuth2ScopeGrant oAuth2ScopeGrant) { long primaryKey = oAuth2ScopeGrant.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 OAuth2ScopeGrant)) { return false; } OAuth2ScopeGrant oAuth2ScopeGrant = (OAuth2ScopeGrant)object; long primaryKey = oAuth2ScopeGrant.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(); _columnBitmask = 0; } @Override public CacheModel toCacheModel() { OAuth2ScopeGrantCacheModel oAuth2ScopeGrantCacheModel = new OAuth2ScopeGrantCacheModel(); oAuth2ScopeGrantCacheModel.oAuth2ScopeGrantId = getOAuth2ScopeGrantId(); oAuth2ScopeGrantCacheModel.companyId = getCompanyId(); oAuth2ScopeGrantCacheModel.oAuth2ApplicationScopeAliasesId = getOAuth2ApplicationScopeAliasesId(); oAuth2ScopeGrantCacheModel.applicationName = getApplicationName(); String applicationName = oAuth2ScopeGrantCacheModel.applicationName; if ((applicationName != null) && (applicationName.length() == 0)) { oAuth2ScopeGrantCacheModel.applicationName = null; } oAuth2ScopeGrantCacheModel.bundleSymbolicName = getBundleSymbolicName(); String bundleSymbolicName = oAuth2ScopeGrantCacheModel.bundleSymbolicName; if ((bundleSymbolicName != null) && (bundleSymbolicName.length() == 0)) { oAuth2ScopeGrantCacheModel.bundleSymbolicName = null; } oAuth2ScopeGrantCacheModel.scope = getScope(); String scope = oAuth2ScopeGrantCacheModel.scope; if ((scope != null) && (scope.length() == 0)) { oAuth2ScopeGrantCacheModel.scope = null; } oAuth2ScopeGrantCacheModel.scopeAliases = getScopeAliases(); String scopeAliases = oAuth2ScopeGrantCacheModel.scopeAliases; if ((scopeAliases != null) && (scopeAliases.length() == 0)) { oAuth2ScopeGrantCacheModel.scopeAliases = null; } return oAuth2ScopeGrantCacheModel; } @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( (OAuth2ScopeGrant)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( OAuth2ScopeGrant.class, ModelWrapper.class); } private long _oAuth2ScopeGrantId; private long _companyId; private long _oAuth2ApplicationScopeAliasesId; private String _applicationName; private String _bundleSymbolicName; private String _scope; private String _scopeAliases; 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((OAuth2ScopeGrant)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("oAuth2ScopeGrantId", _oAuth2ScopeGrantId); _columnOriginalValues.put("companyId", _companyId); _columnOriginalValues.put( "oA2AScopeAliasesId", _oAuth2ApplicationScopeAliasesId); _columnOriginalValues.put("applicationName", _applicationName); _columnOriginalValues.put("bundleSymbolicName", _bundleSymbolicName); _columnOriginalValues.put("scope", _scope); _columnOriginalValues.put("scopeAliases", _scopeAliases); } private static final Map _attributeNames; static { Map attributeNames = new HashMap<>(); attributeNames.put( "oA2AScopeAliasesId", "oAuth2ApplicationScopeAliasesId"); _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("oAuth2ScopeGrantId", 1L); columnBitmasks.put("companyId", 2L); columnBitmasks.put("oA2AScopeAliasesId", 4L); columnBitmasks.put("applicationName", 8L); columnBitmasks.put("bundleSymbolicName", 16L); columnBitmasks.put("scope", 32L); columnBitmasks.put("scopeAliases", 64L); _columnBitmasks = Collections.unmodifiableMap(columnBitmasks); } private long _columnBitmask; private OAuth2ScopeGrant _escapedModel; }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy