com.liferay.oauth2.provider.model.impl.OAuth2AuthorizationModelImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of com.liferay.oauth2.provider.service
Show all versions of com.liferay.oauth2.provider.service
Liferay OAuth2 Provider Service
/**
* 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.OAuth2Authorization;
import com.liferay.oauth2.provider.model.OAuth2AuthorizationModel;
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.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.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 OAuth2Authorization service. Represents a row in the "OAuth2Authorization" database table, with each column mapped to a property of this class.
*
*
* This implementation and its corresponding interface OAuth2AuthorizationModel
exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link OAuth2AuthorizationImpl}.
*
*
* @author Brian Wing Shun Chan
* @see OAuth2AuthorizationImpl
* @generated
*/
public class OAuth2AuthorizationModelImpl
extends BaseModelImpl
implements OAuth2AuthorizationModel {
/*
* NOTE FOR DEVELOPERS:
*
* Never modify or reference this class directly. All methods that expect a o auth2 authorization model instance should use the OAuth2Authorization
interface instead.
*/
public static final String TABLE_NAME = "OAuth2Authorization";
public static final Object[][] TABLE_COLUMNS = {
{"oAuth2AuthorizationId", Types.BIGINT}, {"companyId", Types.BIGINT},
{"userId", Types.BIGINT}, {"userName", Types.VARCHAR},
{"createDate", Types.TIMESTAMP}, {"oAuth2ApplicationId", Types.BIGINT},
{"oA2AScopeAliasesId", Types.BIGINT},
{"accessTokenContent", Types.CLOB},
{"accessTokenContentHash", Types.BIGINT},
{"accessTokenCreateDate", Types.TIMESTAMP},
{"accessTokenExpirationDate", Types.TIMESTAMP},
{"remoteHostInfo", Types.VARCHAR}, {"remoteIPInfo", Types.VARCHAR},
{"refreshTokenContent", Types.CLOB},
{"refreshTokenContentHash", Types.BIGINT},
{"refreshTokenCreateDate", Types.TIMESTAMP},
{"refreshTokenExpirationDate", Types.TIMESTAMP},
{"rememberDeviceContent", Types.VARCHAR}
};
public static final Map TABLE_COLUMNS_MAP =
new HashMap();
static {
TABLE_COLUMNS_MAP.put("oAuth2AuthorizationId", 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("oAuth2ApplicationId", Types.BIGINT);
TABLE_COLUMNS_MAP.put("oA2AScopeAliasesId", Types.BIGINT);
TABLE_COLUMNS_MAP.put("accessTokenContent", Types.CLOB);
TABLE_COLUMNS_MAP.put("accessTokenContentHash", Types.BIGINT);
TABLE_COLUMNS_MAP.put("accessTokenCreateDate", Types.TIMESTAMP);
TABLE_COLUMNS_MAP.put("accessTokenExpirationDate", Types.TIMESTAMP);
TABLE_COLUMNS_MAP.put("remoteHostInfo", Types.VARCHAR);
TABLE_COLUMNS_MAP.put("remoteIPInfo", Types.VARCHAR);
TABLE_COLUMNS_MAP.put("refreshTokenContent", Types.CLOB);
TABLE_COLUMNS_MAP.put("refreshTokenContentHash", Types.BIGINT);
TABLE_COLUMNS_MAP.put("refreshTokenCreateDate", Types.TIMESTAMP);
TABLE_COLUMNS_MAP.put("refreshTokenExpirationDate", Types.TIMESTAMP);
TABLE_COLUMNS_MAP.put("rememberDeviceContent", Types.VARCHAR);
}
public static final String TABLE_SQL_CREATE =
"create table OAuth2Authorization (oAuth2AuthorizationId LONG not null primary key,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,oAuth2ApplicationId LONG,oA2AScopeAliasesId LONG,accessTokenContent TEXT null,accessTokenContentHash LONG,accessTokenCreateDate DATE null,accessTokenExpirationDate DATE null,remoteHostInfo VARCHAR(255) null,remoteIPInfo VARCHAR(75) null,refreshTokenContent TEXT null,refreshTokenContentHash LONG,refreshTokenCreateDate DATE null,refreshTokenExpirationDate DATE null,rememberDeviceContent VARCHAR(75) null)";
public static final String TABLE_SQL_DROP =
"drop table OAuth2Authorization";
public static final String ORDER_BY_JPQL =
" ORDER BY oAuth2Authorization.oAuth2AuthorizationId ASC";
public static final String ORDER_BY_SQL =
" ORDER BY OAuth2Authorization.oAuth2AuthorizationId 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 ACCESSTOKENCONTENTHASH_COLUMN_BITMASK = 1L;
/**
* @deprecated As of Athanasius (7.3.x), replaced by {@link #getColumnBitmask(String)}
*/
@Deprecated
public static final long COMPANYID_COLUMN_BITMASK = 2L;
/**
* @deprecated As of Athanasius (7.3.x), replaced by {@link #getColumnBitmask(String)}
*/
@Deprecated
public static final long OAUTH2APPLICATIONID_COLUMN_BITMASK = 4L;
/**
* @deprecated As of Athanasius (7.3.x), replaced by {@link #getColumnBitmask(String)}
*/
@Deprecated
public static final long REFRESHTOKENCONTENTHASH_COLUMN_BITMASK = 8L;
/**
* @deprecated As of Athanasius (7.3.x), replaced by {@link #getColumnBitmask(String)}
*/
@Deprecated
public static final long REMEMBERDEVICECONTENT_COLUMN_BITMASK = 16L;
/**
* @deprecated As of Athanasius (7.3.x), replaced by {@link #getColumnBitmask(String)}
*/
@Deprecated
public static final long USERID_COLUMN_BITMASK = 32L;
/**
* @deprecated As of Athanasius (7.3.x), replaced by {@link
* #getColumnBitmask(String)}
*/
@Deprecated
public static final long OAUTH2AUTHORIZATIONID_COLUMN_BITMASK = 64L;
/**
* @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 OAuth2AuthorizationModelImpl() {
}
@Override
public long getPrimaryKey() {
return _oAuth2AuthorizationId;
}
@Override
public void setPrimaryKey(long primaryKey) {
setOAuth2AuthorizationId(primaryKey);
}
@Override
public Serializable getPrimaryKeyObj() {
return _oAuth2AuthorizationId;
}
@Override
public void setPrimaryKeyObj(Serializable primaryKeyObj) {
setPrimaryKey(((Long)primaryKeyObj).longValue());
}
@Override
public Class> getModelClass() {
return OAuth2Authorization.class;
}
@Override
public String getModelClassName() {
return OAuth2Authorization.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((OAuth2Authorization)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(
(OAuth2Authorization)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(
"oAuth2AuthorizationId",
OAuth2Authorization::getOAuth2AuthorizationId);
attributeGetterFunctions.put(
"companyId", OAuth2Authorization::getCompanyId);
attributeGetterFunctions.put(
"userId", OAuth2Authorization::getUserId);
attributeGetterFunctions.put(
"userName", OAuth2Authorization::getUserName);
attributeGetterFunctions.put(
"createDate", OAuth2Authorization::getCreateDate);
attributeGetterFunctions.put(
"oAuth2ApplicationId",
OAuth2Authorization::getOAuth2ApplicationId);
attributeGetterFunctions.put(
"oAuth2ApplicationScopeAliasesId",
OAuth2Authorization::getOAuth2ApplicationScopeAliasesId);
attributeGetterFunctions.put(
"accessTokenContent",
OAuth2Authorization::getAccessTokenContent);
attributeGetterFunctions.put(
"accessTokenContentHash",
OAuth2Authorization::getAccessTokenContentHash);
attributeGetterFunctions.put(
"accessTokenCreateDate",
OAuth2Authorization::getAccessTokenCreateDate);
attributeGetterFunctions.put(
"accessTokenExpirationDate",
OAuth2Authorization::getAccessTokenExpirationDate);
attributeGetterFunctions.put(
"remoteHostInfo", OAuth2Authorization::getRemoteHostInfo);
attributeGetterFunctions.put(
"remoteIPInfo", OAuth2Authorization::getRemoteIPInfo);
attributeGetterFunctions.put(
"refreshTokenContent",
OAuth2Authorization::getRefreshTokenContent);
attributeGetterFunctions.put(
"refreshTokenContentHash",
OAuth2Authorization::getRefreshTokenContentHash);
attributeGetterFunctions.put(
"refreshTokenCreateDate",
OAuth2Authorization::getRefreshTokenCreateDate);
attributeGetterFunctions.put(
"refreshTokenExpirationDate",
OAuth2Authorization::getRefreshTokenExpirationDate);
attributeGetterFunctions.put(
"rememberDeviceContent",
OAuth2Authorization::getRememberDeviceContent);
_attributeGetterFunctions = Collections.unmodifiableMap(
attributeGetterFunctions);
}
}
private static class AttributeSetterBiConsumersHolder {
private static final Map
>
_attributeSetterBiConsumers;
static {
Map>
attributeSetterBiConsumers =
new LinkedHashMap
>();
attributeSetterBiConsumers.put(
"oAuth2AuthorizationId",
(BiConsumer)
OAuth2Authorization::setOAuth2AuthorizationId);
attributeSetterBiConsumers.put(
"companyId",
(BiConsumer)
OAuth2Authorization::setCompanyId);
attributeSetterBiConsumers.put(
"userId",
(BiConsumer)
OAuth2Authorization::setUserId);
attributeSetterBiConsumers.put(
"userName",
(BiConsumer)
OAuth2Authorization::setUserName);
attributeSetterBiConsumers.put(
"createDate",
(BiConsumer)
OAuth2Authorization::setCreateDate);
attributeSetterBiConsumers.put(
"oAuth2ApplicationId",
(BiConsumer)
OAuth2Authorization::setOAuth2ApplicationId);
attributeSetterBiConsumers.put(
"oAuth2ApplicationScopeAliasesId",
(BiConsumer)
OAuth2Authorization::setOAuth2ApplicationScopeAliasesId);
attributeSetterBiConsumers.put(
"accessTokenContent",
(BiConsumer)
OAuth2Authorization::setAccessTokenContent);
attributeSetterBiConsumers.put(
"accessTokenContentHash",
(BiConsumer)
OAuth2Authorization::setAccessTokenContentHash);
attributeSetterBiConsumers.put(
"accessTokenCreateDate",
(BiConsumer)
OAuth2Authorization::setAccessTokenCreateDate);
attributeSetterBiConsumers.put(
"accessTokenExpirationDate",
(BiConsumer)
OAuth2Authorization::setAccessTokenExpirationDate);
attributeSetterBiConsumers.put(
"remoteHostInfo",
(BiConsumer)
OAuth2Authorization::setRemoteHostInfo);
attributeSetterBiConsumers.put(
"remoteIPInfo",
(BiConsumer)
OAuth2Authorization::setRemoteIPInfo);
attributeSetterBiConsumers.put(
"refreshTokenContent",
(BiConsumer)
OAuth2Authorization::setRefreshTokenContent);
attributeSetterBiConsumers.put(
"refreshTokenContentHash",
(BiConsumer)
OAuth2Authorization::setRefreshTokenContentHash);
attributeSetterBiConsumers.put(
"refreshTokenCreateDate",
(BiConsumer)
OAuth2Authorization::setRefreshTokenCreateDate);
attributeSetterBiConsumers.put(
"refreshTokenExpirationDate",
(BiConsumer)
OAuth2Authorization::setRefreshTokenExpirationDate);
attributeSetterBiConsumers.put(
"rememberDeviceContent",
(BiConsumer)
OAuth2Authorization::setRememberDeviceContent);
_attributeSetterBiConsumers = Collections.unmodifiableMap(
(Map)attributeSetterBiConsumers);
}
}
@Override
public long getOAuth2AuthorizationId() {
return _oAuth2AuthorizationId;
}
@Override
public void setOAuth2AuthorizationId(long oAuth2AuthorizationId) {
if (_columnOriginalValues == Collections.EMPTY_MAP) {
_setColumnOriginalValues();
}
_oAuth2AuthorizationId = oAuth2AuthorizationId;
}
@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 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) {
}
/**
* @deprecated As of Athanasius (7.3.x), replaced by {@link
* #getColumnOriginalValue(String)}
*/
@Deprecated
public long getOriginalUserId() {
return GetterUtil.getLong(this.getColumnOriginalValue("userId"));
}
@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;
}
@Override
public Date getCreateDate() {
return _createDate;
}
@Override
public void setCreateDate(Date createDate) {
if (_columnOriginalValues == Collections.EMPTY_MAP) {
_setColumnOriginalValues();
}
_createDate = createDate;
}
@Override
public long getOAuth2ApplicationId() {
return _oAuth2ApplicationId;
}
@Override
public void setOAuth2ApplicationId(long oAuth2ApplicationId) {
if (_columnOriginalValues == Collections.EMPTY_MAP) {
_setColumnOriginalValues();
}
_oAuth2ApplicationId = oAuth2ApplicationId;
}
/**
* @deprecated As of Athanasius (7.3.x), replaced by {@link
* #getColumnOriginalValue(String)}
*/
@Deprecated
public long getOriginalOAuth2ApplicationId() {
return GetterUtil.getLong(
this.getColumnOriginalValue("oAuth2ApplicationId"));
}
@Override
public long getOAuth2ApplicationScopeAliasesId() {
return _oAuth2ApplicationScopeAliasesId;
}
@Override
public void setOAuth2ApplicationScopeAliasesId(
long oAuth2ApplicationScopeAliasesId) {
if (_columnOriginalValues == Collections.EMPTY_MAP) {
_setColumnOriginalValues();
}
_oAuth2ApplicationScopeAliasesId = oAuth2ApplicationScopeAliasesId;
}
@Override
public String getAccessTokenContent() {
if (_accessTokenContent == null) {
return "";
}
else {
return _accessTokenContent;
}
}
@Override
public void setAccessTokenContent(String accessTokenContent) {
if (_columnOriginalValues == Collections.EMPTY_MAP) {
_setColumnOriginalValues();
}
_accessTokenContent = accessTokenContent;
}
@Override
public long getAccessTokenContentHash() {
return _accessTokenContentHash;
}
@Override
public void setAccessTokenContentHash(long accessTokenContentHash) {
if (_columnOriginalValues == Collections.EMPTY_MAP) {
_setColumnOriginalValues();
}
_accessTokenContentHash = accessTokenContentHash;
}
/**
* @deprecated As of Athanasius (7.3.x), replaced by {@link
* #getColumnOriginalValue(String)}
*/
@Deprecated
public long getOriginalAccessTokenContentHash() {
return GetterUtil.getLong(
this.getColumnOriginalValue("accessTokenContentHash"));
}
@Override
public Date getAccessTokenCreateDate() {
return _accessTokenCreateDate;
}
@Override
public void setAccessTokenCreateDate(Date accessTokenCreateDate) {
if (_columnOriginalValues == Collections.EMPTY_MAP) {
_setColumnOriginalValues();
}
_accessTokenCreateDate = accessTokenCreateDate;
}
@Override
public Date getAccessTokenExpirationDate() {
return _accessTokenExpirationDate;
}
@Override
public void setAccessTokenExpirationDate(Date accessTokenExpirationDate) {
if (_columnOriginalValues == Collections.EMPTY_MAP) {
_setColumnOriginalValues();
}
_accessTokenExpirationDate = accessTokenExpirationDate;
}
@Override
public String getRemoteHostInfo() {
if (_remoteHostInfo == null) {
return "";
}
else {
return _remoteHostInfo;
}
}
@Override
public void setRemoteHostInfo(String remoteHostInfo) {
if (_columnOriginalValues == Collections.EMPTY_MAP) {
_setColumnOriginalValues();
}
_remoteHostInfo = remoteHostInfo;
}
@Override
public String getRemoteIPInfo() {
if (_remoteIPInfo == null) {
return "";
}
else {
return _remoteIPInfo;
}
}
@Override
public void setRemoteIPInfo(String remoteIPInfo) {
if (_columnOriginalValues == Collections.EMPTY_MAP) {
_setColumnOriginalValues();
}
_remoteIPInfo = remoteIPInfo;
}
@Override
public String getRefreshTokenContent() {
if (_refreshTokenContent == null) {
return "";
}
else {
return _refreshTokenContent;
}
}
@Override
public void setRefreshTokenContent(String refreshTokenContent) {
if (_columnOriginalValues == Collections.EMPTY_MAP) {
_setColumnOriginalValues();
}
_refreshTokenContent = refreshTokenContent;
}
@Override
public long getRefreshTokenContentHash() {
return _refreshTokenContentHash;
}
@Override
public void setRefreshTokenContentHash(long refreshTokenContentHash) {
if (_columnOriginalValues == Collections.EMPTY_MAP) {
_setColumnOriginalValues();
}
_refreshTokenContentHash = refreshTokenContentHash;
}
/**
* @deprecated As of Athanasius (7.3.x), replaced by {@link
* #getColumnOriginalValue(String)}
*/
@Deprecated
public long getOriginalRefreshTokenContentHash() {
return GetterUtil.getLong(
this.getColumnOriginalValue("refreshTokenContentHash"));
}
@Override
public Date getRefreshTokenCreateDate() {
return _refreshTokenCreateDate;
}
@Override
public void setRefreshTokenCreateDate(Date refreshTokenCreateDate) {
if (_columnOriginalValues == Collections.EMPTY_MAP) {
_setColumnOriginalValues();
}
_refreshTokenCreateDate = refreshTokenCreateDate;
}
@Override
public Date getRefreshTokenExpirationDate() {
return _refreshTokenExpirationDate;
}
@Override
public void setRefreshTokenExpirationDate(Date refreshTokenExpirationDate) {
if (_columnOriginalValues == Collections.EMPTY_MAP) {
_setColumnOriginalValues();
}
_refreshTokenExpirationDate = refreshTokenExpirationDate;
}
@Override
public String getRememberDeviceContent() {
if (_rememberDeviceContent == null) {
return "";
}
else {
return _rememberDeviceContent;
}
}
@Override
public void setRememberDeviceContent(String rememberDeviceContent) {
if (_columnOriginalValues == Collections.EMPTY_MAP) {
_setColumnOriginalValues();
}
_rememberDeviceContent = rememberDeviceContent;
}
/**
* @deprecated As of Athanasius (7.3.x), replaced by {@link
* #getColumnOriginalValue(String)}
*/
@Deprecated
public String getOriginalRememberDeviceContent() {
return getColumnOriginalValue("rememberDeviceContent");
}
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(), OAuth2Authorization.class.getName(),
getPrimaryKey());
}
@Override
public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
ExpandoBridge expandoBridge = getExpandoBridge();
expandoBridge.setAttributes(serviceContext);
}
@Override
public OAuth2Authorization toEscapedModel() {
if (_escapedModel == null) {
Function
escapedModelProxyProviderFunction =
EscapedModelProxyProviderFunctionHolder.
_escapedModelProxyProviderFunction;
_escapedModel = escapedModelProxyProviderFunction.apply(
new AutoEscapeBeanHandler(this));
}
return _escapedModel;
}
@Override
public Object clone() {
OAuth2AuthorizationImpl oAuth2AuthorizationImpl =
new OAuth2AuthorizationImpl();
oAuth2AuthorizationImpl.setOAuth2AuthorizationId(
getOAuth2AuthorizationId());
oAuth2AuthorizationImpl.setCompanyId(getCompanyId());
oAuth2AuthorizationImpl.setUserId(getUserId());
oAuth2AuthorizationImpl.setUserName(getUserName());
oAuth2AuthorizationImpl.setCreateDate(getCreateDate());
oAuth2AuthorizationImpl.setOAuth2ApplicationId(
getOAuth2ApplicationId());
oAuth2AuthorizationImpl.setOAuth2ApplicationScopeAliasesId(
getOAuth2ApplicationScopeAliasesId());
oAuth2AuthorizationImpl.setAccessTokenContent(getAccessTokenContent());
oAuth2AuthorizationImpl.setAccessTokenContentHash(
getAccessTokenContentHash());
oAuth2AuthorizationImpl.setAccessTokenCreateDate(
getAccessTokenCreateDate());
oAuth2AuthorizationImpl.setAccessTokenExpirationDate(
getAccessTokenExpirationDate());
oAuth2AuthorizationImpl.setRemoteHostInfo(getRemoteHostInfo());
oAuth2AuthorizationImpl.setRemoteIPInfo(getRemoteIPInfo());
oAuth2AuthorizationImpl.setRefreshTokenContent(
getRefreshTokenContent());
oAuth2AuthorizationImpl.setRefreshTokenContentHash(
getRefreshTokenContentHash());
oAuth2AuthorizationImpl.setRefreshTokenCreateDate(
getRefreshTokenCreateDate());
oAuth2AuthorizationImpl.setRefreshTokenExpirationDate(
getRefreshTokenExpirationDate());
oAuth2AuthorizationImpl.setRememberDeviceContent(
getRememberDeviceContent());
oAuth2AuthorizationImpl.resetOriginalValues();
return oAuth2AuthorizationImpl;
}
@Override
public OAuth2Authorization cloneWithOriginalValues() {
OAuth2AuthorizationImpl oAuth2AuthorizationImpl =
new OAuth2AuthorizationImpl();
oAuth2AuthorizationImpl.setOAuth2AuthorizationId(
this.getColumnOriginalValue("oAuth2AuthorizationId"));
oAuth2AuthorizationImpl.setCompanyId(
this.getColumnOriginalValue("companyId"));
oAuth2AuthorizationImpl.setUserId(
this.getColumnOriginalValue("userId"));
oAuth2AuthorizationImpl.setUserName(
this.getColumnOriginalValue("userName"));
oAuth2AuthorizationImpl.setCreateDate(
this.getColumnOriginalValue("createDate"));
oAuth2AuthorizationImpl.setOAuth2ApplicationId(
this.getColumnOriginalValue("oAuth2ApplicationId"));
oAuth2AuthorizationImpl.setOAuth2ApplicationScopeAliasesId(
this.getColumnOriginalValue("oA2AScopeAliasesId"));
oAuth2AuthorizationImpl.setAccessTokenContent(
this.getColumnOriginalValue("accessTokenContent"));
oAuth2AuthorizationImpl.setAccessTokenContentHash(
this.getColumnOriginalValue("accessTokenContentHash"));
oAuth2AuthorizationImpl.setAccessTokenCreateDate(
this.getColumnOriginalValue("accessTokenCreateDate"));
oAuth2AuthorizationImpl.setAccessTokenExpirationDate(
this.getColumnOriginalValue("accessTokenExpirationDate"));
oAuth2AuthorizationImpl.setRemoteHostInfo(
this.getColumnOriginalValue("remoteHostInfo"));
oAuth2AuthorizationImpl.setRemoteIPInfo(
this.getColumnOriginalValue("remoteIPInfo"));
oAuth2AuthorizationImpl.setRefreshTokenContent(
this.getColumnOriginalValue("refreshTokenContent"));
oAuth2AuthorizationImpl.setRefreshTokenContentHash(
this.getColumnOriginalValue("refreshTokenContentHash"));
oAuth2AuthorizationImpl.setRefreshTokenCreateDate(
this.getColumnOriginalValue("refreshTokenCreateDate"));
oAuth2AuthorizationImpl.setRefreshTokenExpirationDate(
this.getColumnOriginalValue("refreshTokenExpirationDate"));
oAuth2AuthorizationImpl.setRememberDeviceContent(
this.getColumnOriginalValue("rememberDeviceContent"));
return oAuth2AuthorizationImpl;
}
@Override
public int compareTo(OAuth2Authorization oAuth2Authorization) {
long primaryKey = oAuth2Authorization.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 OAuth2Authorization)) {
return false;
}
OAuth2Authorization oAuth2Authorization = (OAuth2Authorization)object;
long primaryKey = oAuth2Authorization.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() {
OAuth2AuthorizationCacheModel oAuth2AuthorizationCacheModel =
new OAuth2AuthorizationCacheModel();
oAuth2AuthorizationCacheModel.oAuth2AuthorizationId =
getOAuth2AuthorizationId();
oAuth2AuthorizationCacheModel.companyId = getCompanyId();
oAuth2AuthorizationCacheModel.userId = getUserId();
oAuth2AuthorizationCacheModel.userName = getUserName();
String userName = oAuth2AuthorizationCacheModel.userName;
if ((userName != null) && (userName.length() == 0)) {
oAuth2AuthorizationCacheModel.userName = null;
}
Date createDate = getCreateDate();
if (createDate != null) {
oAuth2AuthorizationCacheModel.createDate = createDate.getTime();
}
else {
oAuth2AuthorizationCacheModel.createDate = Long.MIN_VALUE;
}
oAuth2AuthorizationCacheModel.oAuth2ApplicationId =
getOAuth2ApplicationId();
oAuth2AuthorizationCacheModel.oAuth2ApplicationScopeAliasesId =
getOAuth2ApplicationScopeAliasesId();
oAuth2AuthorizationCacheModel.accessTokenContent =
getAccessTokenContent();
String accessTokenContent =
oAuth2AuthorizationCacheModel.accessTokenContent;
if ((accessTokenContent != null) &&
(accessTokenContent.length() == 0)) {
oAuth2AuthorizationCacheModel.accessTokenContent = null;
}
oAuth2AuthorizationCacheModel.accessTokenContentHash =
getAccessTokenContentHash();
Date accessTokenCreateDate = getAccessTokenCreateDate();
if (accessTokenCreateDate != null) {
oAuth2AuthorizationCacheModel.accessTokenCreateDate =
accessTokenCreateDate.getTime();
}
else {
oAuth2AuthorizationCacheModel.accessTokenCreateDate =
Long.MIN_VALUE;
}
Date accessTokenExpirationDate = getAccessTokenExpirationDate();
if (accessTokenExpirationDate != null) {
oAuth2AuthorizationCacheModel.accessTokenExpirationDate =
accessTokenExpirationDate.getTime();
}
else {
oAuth2AuthorizationCacheModel.accessTokenExpirationDate =
Long.MIN_VALUE;
}
oAuth2AuthorizationCacheModel.remoteHostInfo = getRemoteHostInfo();
String remoteHostInfo = oAuth2AuthorizationCacheModel.remoteHostInfo;
if ((remoteHostInfo != null) && (remoteHostInfo.length() == 0)) {
oAuth2AuthorizationCacheModel.remoteHostInfo = null;
}
oAuth2AuthorizationCacheModel.remoteIPInfo = getRemoteIPInfo();
String remoteIPInfo = oAuth2AuthorizationCacheModel.remoteIPInfo;
if ((remoteIPInfo != null) && (remoteIPInfo.length() == 0)) {
oAuth2AuthorizationCacheModel.remoteIPInfo = null;
}
oAuth2AuthorizationCacheModel.refreshTokenContent =
getRefreshTokenContent();
String refreshTokenContent =
oAuth2AuthorizationCacheModel.refreshTokenContent;
if ((refreshTokenContent != null) &&
(refreshTokenContent.length() == 0)) {
oAuth2AuthorizationCacheModel.refreshTokenContent = null;
}
oAuth2AuthorizationCacheModel.refreshTokenContentHash =
getRefreshTokenContentHash();
Date refreshTokenCreateDate = getRefreshTokenCreateDate();
if (refreshTokenCreateDate != null) {
oAuth2AuthorizationCacheModel.refreshTokenCreateDate =
refreshTokenCreateDate.getTime();
}
else {
oAuth2AuthorizationCacheModel.refreshTokenCreateDate =
Long.MIN_VALUE;
}
Date refreshTokenExpirationDate = getRefreshTokenExpirationDate();
if (refreshTokenExpirationDate != null) {
oAuth2AuthorizationCacheModel.refreshTokenExpirationDate =
refreshTokenExpirationDate.getTime();
}
else {
oAuth2AuthorizationCacheModel.refreshTokenExpirationDate =
Long.MIN_VALUE;
}
oAuth2AuthorizationCacheModel.rememberDeviceContent =
getRememberDeviceContent();
String rememberDeviceContent =
oAuth2AuthorizationCacheModel.rememberDeviceContent;
if ((rememberDeviceContent != null) &&
(rememberDeviceContent.length() == 0)) {
oAuth2AuthorizationCacheModel.rememberDeviceContent = null;
}
return oAuth2AuthorizationCacheModel;
}
@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(
(OAuth2Authorization)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(
OAuth2Authorization.class, ModelWrapper.class);
}
private long _oAuth2AuthorizationId;
private long _companyId;
private long _userId;
private String _userName;
private Date _createDate;
private long _oAuth2ApplicationId;
private long _oAuth2ApplicationScopeAliasesId;
private String _accessTokenContent;
private long _accessTokenContentHash;
private Date _accessTokenCreateDate;
private Date _accessTokenExpirationDate;
private String _remoteHostInfo;
private String _remoteIPInfo;
private String _refreshTokenContent;
private long _refreshTokenContentHash;
private Date _refreshTokenCreateDate;
private Date _refreshTokenExpirationDate;
private String _rememberDeviceContent;
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((OAuth2Authorization)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(
"oAuth2AuthorizationId", _oAuth2AuthorizationId);
_columnOriginalValues.put("companyId", _companyId);
_columnOriginalValues.put("userId", _userId);
_columnOriginalValues.put("userName", _userName);
_columnOriginalValues.put("createDate", _createDate);
_columnOriginalValues.put("oAuth2ApplicationId", _oAuth2ApplicationId);
_columnOriginalValues.put(
"oA2AScopeAliasesId", _oAuth2ApplicationScopeAliasesId);
_columnOriginalValues.put("accessTokenContent", _accessTokenContent);
_columnOriginalValues.put(
"accessTokenContentHash", _accessTokenContentHash);
_columnOriginalValues.put(
"accessTokenCreateDate", _accessTokenCreateDate);
_columnOriginalValues.put(
"accessTokenExpirationDate", _accessTokenExpirationDate);
_columnOriginalValues.put("remoteHostInfo", _remoteHostInfo);
_columnOriginalValues.put("remoteIPInfo", _remoteIPInfo);
_columnOriginalValues.put("refreshTokenContent", _refreshTokenContent);
_columnOriginalValues.put(
"refreshTokenContentHash", _refreshTokenContentHash);
_columnOriginalValues.put(
"refreshTokenCreateDate", _refreshTokenCreateDate);
_columnOriginalValues.put(
"refreshTokenExpirationDate", _refreshTokenExpirationDate);
_columnOriginalValues.put(
"rememberDeviceContent", _rememberDeviceContent);
}
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("oAuth2AuthorizationId", 1L);
columnBitmasks.put("companyId", 2L);
columnBitmasks.put("userId", 4L);
columnBitmasks.put("userName", 8L);
columnBitmasks.put("createDate", 16L);
columnBitmasks.put("oAuth2ApplicationId", 32L);
columnBitmasks.put("oA2AScopeAliasesId", 64L);
columnBitmasks.put("accessTokenContent", 128L);
columnBitmasks.put("accessTokenContentHash", 256L);
columnBitmasks.put("accessTokenCreateDate", 512L);
columnBitmasks.put("accessTokenExpirationDate", 1024L);
columnBitmasks.put("remoteHostInfo", 2048L);
columnBitmasks.put("remoteIPInfo", 4096L);
columnBitmasks.put("refreshTokenContent", 8192L);
columnBitmasks.put("refreshTokenContentHash", 16384L);
columnBitmasks.put("refreshTokenCreateDate", 32768L);
columnBitmasks.put("refreshTokenExpirationDate", 65536L);
columnBitmasks.put("rememberDeviceContent", 131072L);
_columnBitmasks = Collections.unmodifiableMap(columnBitmasks);
}
private long _columnBitmask;
private OAuth2Authorization _escapedModel;
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy