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

com.liferay.sharepoint.rest.oauth2.model.impl.SharepointOAuth2TokenEntryModelImpl Maven / Gradle / Ivy

/**
 * 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.sharepoint.rest.oauth2.model.impl;

import com.liferay.expando.kernel.model.ExpandoBridge;
import com.liferay.expando.kernel.util.ExpandoBridgeFactoryUtil;
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.StringBundler;
import com.liferay.portal.kernel.util.StringUtil;
import com.liferay.sharepoint.rest.oauth2.model.SharepointOAuth2TokenEntry;
import com.liferay.sharepoint.rest.oauth2.model.SharepointOAuth2TokenEntryModel;

import java.io.Serializable;

import java.lang.reflect.Constructor;
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.function.BiConsumer;
import java.util.function.Function;

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

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

* * @author Adolfo Pérez * @see SharepointOAuth2TokenEntryImpl * @generated */ public class SharepointOAuth2TokenEntryModelImpl extends BaseModelImpl implements SharepointOAuth2TokenEntryModel { /* * NOTE FOR DEVELOPERS: * * Never modify or reference this class directly. All methods that expect a sharepoint o auth2 token entry model instance should use the SharepointOAuth2TokenEntry interface instead. */ public static final String TABLE_NAME = "SharepointOAuth2TokenEntry"; public static final Object[][] TABLE_COLUMNS = { {"sharepointOAuth2TokenEntryId", Types.BIGINT}, {"userId", Types.BIGINT}, {"userName", Types.VARCHAR}, {"createDate", Types.TIMESTAMP}, {"accessToken", Types.CLOB}, {"configurationPid", Types.VARCHAR}, {"expirationDate", Types.TIMESTAMP}, {"refreshToken", Types.CLOB} }; public static final Map TABLE_COLUMNS_MAP = new HashMap(); static { TABLE_COLUMNS_MAP.put("sharepointOAuth2TokenEntryId", 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("accessToken", Types.CLOB); TABLE_COLUMNS_MAP.put("configurationPid", Types.VARCHAR); TABLE_COLUMNS_MAP.put("expirationDate", Types.TIMESTAMP); TABLE_COLUMNS_MAP.put("refreshToken", Types.CLOB); } public static final String TABLE_SQL_CREATE = "create table SharepointOAuth2TokenEntry (sharepointOAuth2TokenEntryId LONG not null primary key,userId LONG,userName VARCHAR(75) null,createDate DATE null,accessToken TEXT null,configurationPid VARCHAR(75) null,expirationDate DATE null,refreshToken TEXT null)"; public static final String TABLE_SQL_DROP = "drop table SharepointOAuth2TokenEntry"; public static final String ORDER_BY_JPQL = " ORDER BY sharepointOAuth2TokenEntry.sharepointOAuth2TokenEntryId ASC"; public static final String ORDER_BY_SQL = " ORDER BY SharepointOAuth2TokenEntry.sharepointOAuth2TokenEntryId ASC"; public static final String DATA_SOURCE = "liferayDataSource"; public static final String SESSION_FACTORY = "liferaySessionFactory"; public static final String TX_MANAGER = "liferayTransactionManager"; public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean( com.liferay.sharepoint.rest.oauth2.service.util.ServiceProps.get( "value.object.entity.cache.enabled.com.liferay.sharepoint.rest.oauth2.model.SharepointOAuth2TokenEntry"), true); public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean( com.liferay.sharepoint.rest.oauth2.service.util.ServiceProps.get( "value.object.finder.cache.enabled.com.liferay.sharepoint.rest.oauth2.model.SharepointOAuth2TokenEntry"), true); public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean( com.liferay.sharepoint.rest.oauth2.service.util.ServiceProps.get( "value.object.column.bitmask.enabled.com.liferay.sharepoint.rest.oauth2.model.SharepointOAuth2TokenEntry"), true); public static final long CONFIGURATIONPID_COLUMN_BITMASK = 1L; public static final long USERID_COLUMN_BITMASK = 2L; public static final long SHAREPOINTOAUTH2TOKENENTRYID_COLUMN_BITMASK = 4L; public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong( com.liferay.sharepoint.rest.oauth2.service.util.ServiceProps.get( "lock.expiration.time.com.liferay.sharepoint.rest.oauth2.model.SharepointOAuth2TokenEntry")); public SharepointOAuth2TokenEntryModelImpl() { } @Override public long getPrimaryKey() { return _sharepointOAuth2TokenEntryId; } @Override public void setPrimaryKey(long primaryKey) { setSharepointOAuth2TokenEntryId(primaryKey); } @Override public Serializable getPrimaryKeyObj() { return _sharepointOAuth2TokenEntryId; } @Override public void setPrimaryKeyObj(Serializable primaryKeyObj) { setPrimaryKey(((Long)primaryKeyObj).longValue()); } @Override public Class getModelClass() { return SharepointOAuth2TokenEntry.class; } @Override public String getModelClassName() { return SharepointOAuth2TokenEntry.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( (SharepointOAuth2TokenEntry)this)); } attributes.put("entityCacheEnabled", isEntityCacheEnabled()); attributes.put("finderCacheEnabled", isFinderCacheEnabled()); 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( (SharepointOAuth2TokenEntry)this, entry.getValue()); } } } public Map> getAttributeGetterFunctions() { return _attributeGetterFunctions; } public Map> getAttributeSetterBiConsumers() { return _attributeSetterBiConsumers; } private static Function _getProxyProviderFunction() { Class proxyClass = ProxyUtil.getProxyClass( SharepointOAuth2TokenEntry.class.getClassLoader(), SharepointOAuth2TokenEntry.class, ModelWrapper.class); try { Constructor constructor = (Constructor) proxyClass.getConstructor(InvocationHandler.class); return invocationHandler -> { try { return constructor.newInstance(invocationHandler); } catch (ReflectiveOperationException reflectiveOperationException) { throw new InternalError(reflectiveOperationException); } }; } catch (NoSuchMethodException noSuchMethodException) { throw new InternalError(noSuchMethodException); } } private static final Map > _attributeGetterFunctions; static { Map> attributeGetterFunctions = new LinkedHashMap >(); attributeGetterFunctions.put( "sharepointOAuth2TokenEntryId", new Function() { @Override public Object apply( SharepointOAuth2TokenEntry sharepointOAuth2TokenEntry) { return sharepointOAuth2TokenEntry. getSharepointOAuth2TokenEntryId(); } }); attributeGetterFunctions.put( "userId", new Function() { @Override public Object apply( SharepointOAuth2TokenEntry sharepointOAuth2TokenEntry) { return sharepointOAuth2TokenEntry.getUserId(); } }); attributeGetterFunctions.put( "userName", new Function() { @Override public Object apply( SharepointOAuth2TokenEntry sharepointOAuth2TokenEntry) { return sharepointOAuth2TokenEntry.getUserName(); } }); attributeGetterFunctions.put( "createDate", new Function() { @Override public Object apply( SharepointOAuth2TokenEntry sharepointOAuth2TokenEntry) { return sharepointOAuth2TokenEntry.getCreateDate(); } }); attributeGetterFunctions.put( "accessToken", new Function() { @Override public Object apply( SharepointOAuth2TokenEntry sharepointOAuth2TokenEntry) { return sharepointOAuth2TokenEntry.getAccessToken(); } }); attributeGetterFunctions.put( "configurationPid", new Function() { @Override public Object apply( SharepointOAuth2TokenEntry sharepointOAuth2TokenEntry) { return sharepointOAuth2TokenEntry.getConfigurationPid(); } }); attributeGetterFunctions.put( "expirationDate", new Function() { @Override public Object apply( SharepointOAuth2TokenEntry sharepointOAuth2TokenEntry) { return sharepointOAuth2TokenEntry.getExpirationDate(); } }); attributeGetterFunctions.put( "refreshToken", new Function() { @Override public Object apply( SharepointOAuth2TokenEntry sharepointOAuth2TokenEntry) { return sharepointOAuth2TokenEntry.getRefreshToken(); } }); _attributeGetterFunctions = Collections.unmodifiableMap( attributeGetterFunctions); } private static final Map > _attributeSetterBiConsumers; static { Map> attributeSetterBiConsumers = new LinkedHashMap >(); attributeSetterBiConsumers.put( "sharepointOAuth2TokenEntryId", new BiConsumer() { @Override public void accept( SharepointOAuth2TokenEntry sharepointOAuth2TokenEntry, Object sharepointOAuth2TokenEntryIdObject) { sharepointOAuth2TokenEntry.setSharepointOAuth2TokenEntryId( (Long)sharepointOAuth2TokenEntryIdObject); } }); attributeSetterBiConsumers.put( "userId", new BiConsumer() { @Override public void accept( SharepointOAuth2TokenEntry sharepointOAuth2TokenEntry, Object userIdObject) { sharepointOAuth2TokenEntry.setUserId((Long)userIdObject); } }); attributeSetterBiConsumers.put( "userName", new BiConsumer() { @Override public void accept( SharepointOAuth2TokenEntry sharepointOAuth2TokenEntry, Object userNameObject) { sharepointOAuth2TokenEntry.setUserName( (String)userNameObject); } }); attributeSetterBiConsumers.put( "createDate", new BiConsumer() { @Override public void accept( SharepointOAuth2TokenEntry sharepointOAuth2TokenEntry, Object createDateObject) { sharepointOAuth2TokenEntry.setCreateDate( (Date)createDateObject); } }); attributeSetterBiConsumers.put( "accessToken", new BiConsumer() { @Override public void accept( SharepointOAuth2TokenEntry sharepointOAuth2TokenEntry, Object accessTokenObject) { sharepointOAuth2TokenEntry.setAccessToken( (String)accessTokenObject); } }); attributeSetterBiConsumers.put( "configurationPid", new BiConsumer() { @Override public void accept( SharepointOAuth2TokenEntry sharepointOAuth2TokenEntry, Object configurationPidObject) { sharepointOAuth2TokenEntry.setConfigurationPid( (String)configurationPidObject); } }); attributeSetterBiConsumers.put( "expirationDate", new BiConsumer() { @Override public void accept( SharepointOAuth2TokenEntry sharepointOAuth2TokenEntry, Object expirationDateObject) { sharepointOAuth2TokenEntry.setExpirationDate( (Date)expirationDateObject); } }); attributeSetterBiConsumers.put( "refreshToken", new BiConsumer() { @Override public void accept( SharepointOAuth2TokenEntry sharepointOAuth2TokenEntry, Object refreshTokenObject) { sharepointOAuth2TokenEntry.setRefreshToken( (String)refreshTokenObject); } }); _attributeSetterBiConsumers = Collections.unmodifiableMap( (Map)attributeSetterBiConsumers); } @Override public long getSharepointOAuth2TokenEntryId() { return _sharepointOAuth2TokenEntryId; } @Override public void setSharepointOAuth2TokenEntryId( long sharepointOAuth2TokenEntryId) { _sharepointOAuth2TokenEntryId = sharepointOAuth2TokenEntryId; } @Override public long getUserId() { return _userId; } @Override public void setUserId(long userId) { _columnBitmask |= USERID_COLUMN_BITMASK; if (!_setOriginalUserId) { _setOriginalUserId = true; _originalUserId = _userId; } _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) { } public long getOriginalUserId() { return _originalUserId; } @Override public String getUserName() { if (_userName == null) { return ""; } else { return _userName; } } @Override public void setUserName(String userName) { _userName = userName; } @Override public Date getCreateDate() { return _createDate; } @Override public void setCreateDate(Date createDate) { _createDate = createDate; } @Override public String getAccessToken() { if (_accessToken == null) { return ""; } else { return _accessToken; } } @Override public void setAccessToken(String accessToken) { _accessToken = accessToken; } @Override public String getConfigurationPid() { if (_configurationPid == null) { return ""; } else { return _configurationPid; } } @Override public void setConfigurationPid(String configurationPid) { _columnBitmask |= CONFIGURATIONPID_COLUMN_BITMASK; if (_originalConfigurationPid == null) { _originalConfigurationPid = _configurationPid; } _configurationPid = configurationPid; } public String getOriginalConfigurationPid() { return GetterUtil.getString(_originalConfigurationPid); } @Override public Date getExpirationDate() { return _expirationDate; } @Override public void setExpirationDate(Date expirationDate) { _expirationDate = expirationDate; } @Override public String getRefreshToken() { if (_refreshToken == null) { return ""; } else { return _refreshToken; } } @Override public void setRefreshToken(String refreshToken) { _refreshToken = refreshToken; } public long getColumnBitmask() { return _columnBitmask; } @Override public ExpandoBridge getExpandoBridge() { return ExpandoBridgeFactoryUtil.getExpandoBridge( 0, SharepointOAuth2TokenEntry.class.getName(), getPrimaryKey()); } @Override public void setExpandoBridgeAttributes(ServiceContext serviceContext) { ExpandoBridge expandoBridge = getExpandoBridge(); expandoBridge.setAttributes(serviceContext); } @Override public SharepointOAuth2TokenEntry toEscapedModel() { if (_escapedModel == null) { Function escapedModelProxyProviderFunction = EscapedModelProxyProviderFunctionHolder. _escapedModelProxyProviderFunction; _escapedModel = escapedModelProxyProviderFunction.apply( new AutoEscapeBeanHandler(this)); } return _escapedModel; } @Override public Object clone() { SharepointOAuth2TokenEntryImpl sharepointOAuth2TokenEntryImpl = new SharepointOAuth2TokenEntryImpl(); sharepointOAuth2TokenEntryImpl.setSharepointOAuth2TokenEntryId( getSharepointOAuth2TokenEntryId()); sharepointOAuth2TokenEntryImpl.setUserId(getUserId()); sharepointOAuth2TokenEntryImpl.setUserName(getUserName()); sharepointOAuth2TokenEntryImpl.setCreateDate(getCreateDate()); sharepointOAuth2TokenEntryImpl.setAccessToken(getAccessToken()); sharepointOAuth2TokenEntryImpl.setConfigurationPid( getConfigurationPid()); sharepointOAuth2TokenEntryImpl.setExpirationDate(getExpirationDate()); sharepointOAuth2TokenEntryImpl.setRefreshToken(getRefreshToken()); sharepointOAuth2TokenEntryImpl.resetOriginalValues(); return sharepointOAuth2TokenEntryImpl; } @Override public int compareTo( SharepointOAuth2TokenEntry sharepointOAuth2TokenEntry) { long primaryKey = sharepointOAuth2TokenEntry.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 SharepointOAuth2TokenEntry)) { return false; } SharepointOAuth2TokenEntry sharepointOAuth2TokenEntry = (SharepointOAuth2TokenEntry)object; long primaryKey = sharepointOAuth2TokenEntry.getPrimaryKey(); if (getPrimaryKey() == primaryKey) { return true; } else { return false; } } @Override public int hashCode() { return (int)getPrimaryKey(); } @Override public boolean isEntityCacheEnabled() { return ENTITY_CACHE_ENABLED; } @Override public boolean isFinderCacheEnabled() { return FINDER_CACHE_ENABLED; } @Override public void resetOriginalValues() { _originalUserId = _userId; _setOriginalUserId = false; _originalConfigurationPid = _configurationPid; _columnBitmask = 0; } @Override public CacheModel toCacheModel() { SharepointOAuth2TokenEntryCacheModel sharepointOAuth2TokenEntryCacheModel = new SharepointOAuth2TokenEntryCacheModel(); sharepointOAuth2TokenEntryCacheModel.sharepointOAuth2TokenEntryId = getSharepointOAuth2TokenEntryId(); sharepointOAuth2TokenEntryCacheModel.userId = getUserId(); sharepointOAuth2TokenEntryCacheModel.userName = getUserName(); String userName = sharepointOAuth2TokenEntryCacheModel.userName; if ((userName != null) && (userName.length() == 0)) { sharepointOAuth2TokenEntryCacheModel.userName = null; } Date createDate = getCreateDate(); if (createDate != null) { sharepointOAuth2TokenEntryCacheModel.createDate = createDate.getTime(); } else { sharepointOAuth2TokenEntryCacheModel.createDate = Long.MIN_VALUE; } sharepointOAuth2TokenEntryCacheModel.accessToken = getAccessToken(); String accessToken = sharepointOAuth2TokenEntryCacheModel.accessToken; if ((accessToken != null) && (accessToken.length() == 0)) { sharepointOAuth2TokenEntryCacheModel.accessToken = null; } sharepointOAuth2TokenEntryCacheModel.configurationPid = getConfigurationPid(); String configurationPid = sharepointOAuth2TokenEntryCacheModel.configurationPid; if ((configurationPid != null) && (configurationPid.length() == 0)) { sharepointOAuth2TokenEntryCacheModel.configurationPid = null; } Date expirationDate = getExpirationDate(); if (expirationDate != null) { sharepointOAuth2TokenEntryCacheModel.expirationDate = expirationDate.getTime(); } else { sharepointOAuth2TokenEntryCacheModel.expirationDate = Long.MIN_VALUE; } sharepointOAuth2TokenEntryCacheModel.refreshToken = getRefreshToken(); String refreshToken = sharepointOAuth2TokenEntryCacheModel.refreshToken; if ((refreshToken != null) && (refreshToken.length() == 0)) { sharepointOAuth2TokenEntryCacheModel.refreshToken = null; } return sharepointOAuth2TokenEntryCacheModel; } @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( (SharepointOAuth2TokenEntry)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(); } @Override public String toXmlString() { Map> attributeGetterFunctions = getAttributeGetterFunctions(); StringBundler sb = new StringBundler( (5 * attributeGetterFunctions.size()) + 4); sb.append(""); sb.append(getModelClassName()); sb.append(""); for (Map.Entry> entry : attributeGetterFunctions.entrySet()) { String attributeName = entry.getKey(); Function attributeGetterFunction = entry.getValue(); sb.append(""); sb.append(attributeName); sb.append(""); } sb.append(""); return sb.toString(); } private static class EscapedModelProxyProviderFunctionHolder { private static final Function _escapedModelProxyProviderFunction = _getProxyProviderFunction(); } private long _sharepointOAuth2TokenEntryId; private long _userId; private long _originalUserId; private boolean _setOriginalUserId; private String _userName; private Date _createDate; private String _accessToken; private String _configurationPid; private String _originalConfigurationPid; private Date _expirationDate; private String _refreshToken; private long _columnBitmask; private SharepointOAuth2TokenEntry _escapedModel; }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy