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

com.liferay.saml.persistence.model.impl.SamlSpMessageModelImpl 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.saml.persistence.model.impl;

import com.liferay.expando.kernel.model.ExpandoBridge;
import com.liferay.expando.kernel.util.ExpandoBridgeFactoryUtil;
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.ProxyUtil;
import com.liferay.portal.kernel.util.StringUtil;
import com.liferay.saml.persistence.model.SamlSpMessage;
import com.liferay.saml.persistence.model.SamlSpMessageModel;

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 SamlSpMessage service. Represents a row in the "SamlSpMessage" database table, with each column mapped to a property of this class.
 *
 * 

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

* * @author Mika Koivisto * @see SamlSpMessageImpl * @generated */ public class SamlSpMessageModelImpl extends BaseModelImpl implements SamlSpMessageModel { /* * NOTE FOR DEVELOPERS: * * Never modify or reference this class directly. All methods that expect a saml sp message model instance should use the SamlSpMessage interface instead. */ public static final String TABLE_NAME = "SamlSpMessage"; public static final Object[][] TABLE_COLUMNS = { {"samlSpMessageId", Types.BIGINT}, {"companyId", Types.BIGINT}, {"createDate", Types.TIMESTAMP}, {"samlIdpEntityId", Types.VARCHAR}, {"samlIdpResponseKey", Types.VARCHAR}, {"expirationDate", Types.TIMESTAMP} }; public static final Map TABLE_COLUMNS_MAP = new HashMap(); static { TABLE_COLUMNS_MAP.put("samlSpMessageId", Types.BIGINT); TABLE_COLUMNS_MAP.put("companyId", Types.BIGINT); TABLE_COLUMNS_MAP.put("createDate", Types.TIMESTAMP); TABLE_COLUMNS_MAP.put("samlIdpEntityId", Types.VARCHAR); TABLE_COLUMNS_MAP.put("samlIdpResponseKey", Types.VARCHAR); TABLE_COLUMNS_MAP.put("expirationDate", Types.TIMESTAMP); } public static final String TABLE_SQL_CREATE = "create table SamlSpMessage (samlSpMessageId LONG not null primary key,companyId LONG,createDate DATE null,samlIdpEntityId VARCHAR(1024) null,samlIdpResponseKey VARCHAR(75) null,expirationDate DATE null)"; public static final String TABLE_SQL_DROP = "drop table SamlSpMessage"; public static final String ORDER_BY_JPQL = " ORDER BY samlSpMessage.samlSpMessageId ASC"; public static final String ORDER_BY_SQL = " ORDER BY SamlSpMessage.samlSpMessageId 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 EXPIRATIONDATE_COLUMN_BITMASK = 1L; /** * @deprecated As of Athanasius (7.3.x), replaced by {@link #getColumnBitmask(String)} */ @Deprecated public static final long SAMLIDPENTITYID_COLUMN_BITMASK = 2L; /** * @deprecated As of Athanasius (7.3.x), replaced by {@link #getColumnBitmask(String)} */ @Deprecated public static final long SAMLIDPRESPONSEKEY_COLUMN_BITMASK = 4L; /** * @deprecated As of Athanasius (7.3.x), replaced by {@link * #getColumnBitmask(String)} */ @Deprecated public static final long SAMLSPMESSAGEID_COLUMN_BITMASK = 8L; /** * @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 SamlSpMessageModelImpl() { } @Override public long getPrimaryKey() { return _samlSpMessageId; } @Override public void setPrimaryKey(long primaryKey) { setSamlSpMessageId(primaryKey); } @Override public Serializable getPrimaryKeyObj() { return _samlSpMessageId; } @Override public void setPrimaryKeyObj(Serializable primaryKeyObj) { setPrimaryKey(((Long)primaryKeyObj).longValue()); } @Override public Class getModelClass() { return SamlSpMessage.class; } @Override public String getModelClassName() { return SamlSpMessage.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((SamlSpMessage)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( (SamlSpMessage)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( "samlSpMessageId", SamlSpMessage::getSamlSpMessageId); attributeGetterFunctions.put( "companyId", SamlSpMessage::getCompanyId); attributeGetterFunctions.put( "createDate", SamlSpMessage::getCreateDate); attributeGetterFunctions.put( "samlIdpEntityId", SamlSpMessage::getSamlIdpEntityId); attributeGetterFunctions.put( "samlIdpResponseKey", SamlSpMessage::getSamlIdpResponseKey); attributeGetterFunctions.put( "expirationDate", SamlSpMessage::getExpirationDate); _attributeGetterFunctions = Collections.unmodifiableMap( attributeGetterFunctions); } } private static class AttributeSetterBiConsumersHolder { private static final Map> _attributeSetterBiConsumers; static { Map> attributeSetterBiConsumers = new LinkedHashMap>(); attributeSetterBiConsumers.put( "samlSpMessageId", (BiConsumer) SamlSpMessage::setSamlSpMessageId); attributeSetterBiConsumers.put( "companyId", (BiConsumer)SamlSpMessage::setCompanyId); attributeSetterBiConsumers.put( "createDate", (BiConsumer)SamlSpMessage::setCreateDate); attributeSetterBiConsumers.put( "samlIdpEntityId", (BiConsumer) SamlSpMessage::setSamlIdpEntityId); attributeSetterBiConsumers.put( "samlIdpResponseKey", (BiConsumer) SamlSpMessage::setSamlIdpResponseKey); attributeSetterBiConsumers.put( "expirationDate", (BiConsumer) SamlSpMessage::setExpirationDate); _attributeSetterBiConsumers = Collections.unmodifiableMap( (Map)attributeSetterBiConsumers); } } @Override public long getSamlSpMessageId() { return _samlSpMessageId; } @Override public void setSamlSpMessageId(long samlSpMessageId) { if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } _samlSpMessageId = samlSpMessageId; } @Override public long getCompanyId() { return _companyId; } @Override public void setCompanyId(long companyId) { if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } _companyId = companyId; } @Override public Date getCreateDate() { return _createDate; } @Override public void setCreateDate(Date createDate) { if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } _createDate = createDate; } @Override public String getSamlIdpEntityId() { if (_samlIdpEntityId == null) { return ""; } else { return _samlIdpEntityId; } } @Override public void setSamlIdpEntityId(String samlIdpEntityId) { if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } _samlIdpEntityId = samlIdpEntityId; } /** * @deprecated As of Athanasius (7.3.x), replaced by {@link * #getColumnOriginalValue(String)} */ @Deprecated public String getOriginalSamlIdpEntityId() { return getColumnOriginalValue("samlIdpEntityId"); } @Override public String getSamlIdpResponseKey() { if (_samlIdpResponseKey == null) { return ""; } else { return _samlIdpResponseKey; } } @Override public void setSamlIdpResponseKey(String samlIdpResponseKey) { if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } _samlIdpResponseKey = samlIdpResponseKey; } /** * @deprecated As of Athanasius (7.3.x), replaced by {@link * #getColumnOriginalValue(String)} */ @Deprecated public String getOriginalSamlIdpResponseKey() { return getColumnOriginalValue("samlIdpResponseKey"); } @Override public Date getExpirationDate() { return _expirationDate; } @Override public void setExpirationDate(Date expirationDate) { if (_columnOriginalValues == Collections.EMPTY_MAP) { _setColumnOriginalValues(); } _expirationDate = expirationDate; } /** * @deprecated As of Athanasius (7.3.x), replaced by {@link * #getColumnOriginalValue(String)} */ @Deprecated public Date getOriginalExpirationDate() { return getColumnOriginalValue("expirationDate"); } 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(), SamlSpMessage.class.getName(), getPrimaryKey()); } @Override public void setExpandoBridgeAttributes(ServiceContext serviceContext) { ExpandoBridge expandoBridge = getExpandoBridge(); expandoBridge.setAttributes(serviceContext); } @Override public SamlSpMessage toEscapedModel() { if (_escapedModel == null) { Function escapedModelProxyProviderFunction = EscapedModelProxyProviderFunctionHolder. _escapedModelProxyProviderFunction; _escapedModel = escapedModelProxyProviderFunction.apply( new AutoEscapeBeanHandler(this)); } return _escapedModel; } @Override public Object clone() { SamlSpMessageImpl samlSpMessageImpl = new SamlSpMessageImpl(); samlSpMessageImpl.setSamlSpMessageId(getSamlSpMessageId()); samlSpMessageImpl.setCompanyId(getCompanyId()); samlSpMessageImpl.setCreateDate(getCreateDate()); samlSpMessageImpl.setSamlIdpEntityId(getSamlIdpEntityId()); samlSpMessageImpl.setSamlIdpResponseKey(getSamlIdpResponseKey()); samlSpMessageImpl.setExpirationDate(getExpirationDate()); samlSpMessageImpl.resetOriginalValues(); return samlSpMessageImpl; } @Override public SamlSpMessage cloneWithOriginalValues() { SamlSpMessageImpl samlSpMessageImpl = new SamlSpMessageImpl(); samlSpMessageImpl.setSamlSpMessageId( this.getColumnOriginalValue("samlSpMessageId")); samlSpMessageImpl.setCompanyId( this.getColumnOriginalValue("companyId")); samlSpMessageImpl.setCreateDate( this.getColumnOriginalValue("createDate")); samlSpMessageImpl.setSamlIdpEntityId( this.getColumnOriginalValue("samlIdpEntityId")); samlSpMessageImpl.setSamlIdpResponseKey( this.getColumnOriginalValue("samlIdpResponseKey")); samlSpMessageImpl.setExpirationDate( this.getColumnOriginalValue("expirationDate")); return samlSpMessageImpl; } @Override public int compareTo(SamlSpMessage samlSpMessage) { long primaryKey = samlSpMessage.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 SamlSpMessage)) { return false; } SamlSpMessage samlSpMessage = (SamlSpMessage)object; long primaryKey = samlSpMessage.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() { SamlSpMessageCacheModel samlSpMessageCacheModel = new SamlSpMessageCacheModel(); samlSpMessageCacheModel.samlSpMessageId = getSamlSpMessageId(); samlSpMessageCacheModel.companyId = getCompanyId(); Date createDate = getCreateDate(); if (createDate != null) { samlSpMessageCacheModel.createDate = createDate.getTime(); } else { samlSpMessageCacheModel.createDate = Long.MIN_VALUE; } samlSpMessageCacheModel.samlIdpEntityId = getSamlIdpEntityId(); String samlIdpEntityId = samlSpMessageCacheModel.samlIdpEntityId; if ((samlIdpEntityId != null) && (samlIdpEntityId.length() == 0)) { samlSpMessageCacheModel.samlIdpEntityId = null; } samlSpMessageCacheModel.samlIdpResponseKey = getSamlIdpResponseKey(); String samlIdpResponseKey = samlSpMessageCacheModel.samlIdpResponseKey; if ((samlIdpResponseKey != null) && (samlIdpResponseKey.length() == 0)) { samlSpMessageCacheModel.samlIdpResponseKey = null; } Date expirationDate = getExpirationDate(); if (expirationDate != null) { samlSpMessageCacheModel.expirationDate = expirationDate.getTime(); } else { samlSpMessageCacheModel.expirationDate = Long.MIN_VALUE; } return samlSpMessageCacheModel; } @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((SamlSpMessage)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( SamlSpMessage.class, ModelWrapper.class); } private long _samlSpMessageId; private long _companyId; private Date _createDate; private String _samlIdpEntityId; private String _samlIdpResponseKey; private Date _expirationDate; public T getColumnValue(String columnName) { Function function = AttributeGetterFunctionsHolder._attributeGetterFunctions.get( columnName); if (function == null) { throw new IllegalArgumentException( "No attribute getter function found for " + columnName); } return (T)function.apply((SamlSpMessage)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("samlSpMessageId", _samlSpMessageId); _columnOriginalValues.put("companyId", _companyId); _columnOriginalValues.put("createDate", _createDate); _columnOriginalValues.put("samlIdpEntityId", _samlIdpEntityId); _columnOriginalValues.put("samlIdpResponseKey", _samlIdpResponseKey); _columnOriginalValues.put("expirationDate", _expirationDate); } 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("samlSpMessageId", 1L); columnBitmasks.put("companyId", 2L); columnBitmasks.put("createDate", 4L); columnBitmasks.put("samlIdpEntityId", 8L); columnBitmasks.put("samlIdpResponseKey", 16L); columnBitmasks.put("expirationDate", 32L); _columnBitmasks = Collections.unmodifiableMap(columnBitmasks); } private long _columnBitmask; private SamlSpMessage _escapedModel; }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy