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

com.liferay.document.library.sync.model.impl.DLSyncEventModelImpl 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.document.library.sync.model.impl;

import com.liferay.document.library.sync.model.DLSyncEvent;
import com.liferay.document.library.sync.model.DLSyncEventModel;
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 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.function.BiConsumer;
import java.util.function.Function;

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

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

* * @author Brian Wing Shun Chan * @see DLSyncEventImpl * @generated */ public class DLSyncEventModelImpl extends BaseModelImpl implements DLSyncEventModel { /* * NOTE FOR DEVELOPERS: * * Never modify or reference this class directly. All methods that expect a dl sync event model instance should use the DLSyncEvent interface instead. */ public static final String TABLE_NAME = "DLSyncEvent"; public static final Object[][] TABLE_COLUMNS = { {"syncEventId", Types.BIGINT}, {"companyId", Types.BIGINT}, {"modifiedTime", Types.BIGINT}, {"event", Types.VARCHAR}, {"type_", Types.VARCHAR}, {"typePK", Types.BIGINT} }; public static final Map TABLE_COLUMNS_MAP = new HashMap(); static { TABLE_COLUMNS_MAP.put("syncEventId", Types.BIGINT); TABLE_COLUMNS_MAP.put("companyId", Types.BIGINT); TABLE_COLUMNS_MAP.put("modifiedTime", Types.BIGINT); TABLE_COLUMNS_MAP.put("event", Types.VARCHAR); TABLE_COLUMNS_MAP.put("type_", Types.VARCHAR); TABLE_COLUMNS_MAP.put("typePK", Types.BIGINT); } public static final String TABLE_SQL_CREATE = "create table DLSyncEvent (syncEventId LONG not null primary key,companyId LONG,modifiedTime LONG,event VARCHAR(75) null,type_ VARCHAR(75) null,typePK LONG)"; public static final String TABLE_SQL_DROP = "drop table DLSyncEvent"; public static final String ORDER_BY_JPQL = " ORDER BY dlSyncEvent.modifiedTime ASC"; public static final String ORDER_BY_SQL = " ORDER BY DLSyncEvent.modifiedTime 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 long MODIFIEDTIME_COLUMN_BITMASK = 1L; public static final long TYPEPK_COLUMN_BITMASK = 2L; public static void setEntityCacheEnabled(boolean entityCacheEnabled) { _entityCacheEnabled = entityCacheEnabled; } public static void setFinderCacheEnabled(boolean finderCacheEnabled) { _finderCacheEnabled = finderCacheEnabled; } public DLSyncEventModelImpl() { } @Override public long getPrimaryKey() { return _syncEventId; } @Override public void setPrimaryKey(long primaryKey) { setSyncEventId(primaryKey); } @Override public Serializable getPrimaryKeyObj() { return _syncEventId; } @Override public void setPrimaryKeyObj(Serializable primaryKeyObj) { setPrimaryKey(((Long)primaryKeyObj).longValue()); } @Override public Class getModelClass() { return DLSyncEvent.class; } @Override public String getModelClassName() { return DLSyncEvent.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((DLSyncEvent)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( (DLSyncEvent)this, entry.getValue()); } } } public Map> getAttributeGetterFunctions() { return _attributeGetterFunctions; } public Map> getAttributeSetterBiConsumers() { return _attributeSetterBiConsumers; } private static final Map> _attributeGetterFunctions; static { Map> attributeGetterFunctions = new LinkedHashMap>(); attributeGetterFunctions.put( "syncEventId", DLSyncEvent::getSyncEventId); attributeGetterFunctions.put("companyId", DLSyncEvent::getCompanyId); attributeGetterFunctions.put( "modifiedTime", DLSyncEvent::getModifiedTime); attributeGetterFunctions.put("event", DLSyncEvent::getEvent); attributeGetterFunctions.put("type", DLSyncEvent::getType); attributeGetterFunctions.put("typePK", DLSyncEvent::getTypePK); _attributeGetterFunctions = Collections.unmodifiableMap( attributeGetterFunctions); } private static final Map> _attributeSetterBiConsumers; static { Map> attributeSetterBiConsumers = new LinkedHashMap>(); attributeSetterBiConsumers.put( "syncEventId", (BiConsumer)DLSyncEvent::setSyncEventId); attributeSetterBiConsumers.put( "companyId", (BiConsumer)DLSyncEvent::setCompanyId); attributeSetterBiConsumers.put( "modifiedTime", (BiConsumer)DLSyncEvent::setModifiedTime); attributeSetterBiConsumers.put( "event", (BiConsumer)DLSyncEvent::setEvent); attributeSetterBiConsumers.put( "type", (BiConsumer)DLSyncEvent::setType); attributeSetterBiConsumers.put( "typePK", (BiConsumer)DLSyncEvent::setTypePK); _attributeSetterBiConsumers = Collections.unmodifiableMap( (Map)attributeSetterBiConsumers); } @Override public long getSyncEventId() { return _syncEventId; } @Override public void setSyncEventId(long syncEventId) { _syncEventId = syncEventId; } @Override public long getCompanyId() { return _companyId; } @Override public void setCompanyId(long companyId) { _companyId = companyId; } @Override public long getModifiedTime() { return _modifiedTime; } @Override public void setModifiedTime(long modifiedTime) { _columnBitmask = -1L; if (!_setOriginalModifiedTime) { _setOriginalModifiedTime = true; _originalModifiedTime = _modifiedTime; } _modifiedTime = modifiedTime; } public long getOriginalModifiedTime() { return _originalModifiedTime; } @Override public String getEvent() { if (_event == null) { return ""; } else { return _event; } } @Override public void setEvent(String event) { _event = event; } @Override public String getType() { if (_type == null) { return ""; } else { return _type; } } @Override public void setType(String type) { _type = type; } @Override public long getTypePK() { return _typePK; } @Override public void setTypePK(long typePK) { _columnBitmask |= TYPEPK_COLUMN_BITMASK; if (!_setOriginalTypePK) { _setOriginalTypePK = true; _originalTypePK = _typePK; } _typePK = typePK; } public long getOriginalTypePK() { return _originalTypePK; } public long getColumnBitmask() { return _columnBitmask; } @Override public ExpandoBridge getExpandoBridge() { return ExpandoBridgeFactoryUtil.getExpandoBridge( getCompanyId(), DLSyncEvent.class.getName(), getPrimaryKey()); } @Override public void setExpandoBridgeAttributes(ServiceContext serviceContext) { ExpandoBridge expandoBridge = getExpandoBridge(); expandoBridge.setAttributes(serviceContext); } @Override public DLSyncEvent toEscapedModel() { if (_escapedModel == null) { Function escapedModelProxyProviderFunction = EscapedModelProxyProviderFunctionHolder. _escapedModelProxyProviderFunction; _escapedModel = escapedModelProxyProviderFunction.apply( new AutoEscapeBeanHandler(this)); } return _escapedModel; } @Override public Object clone() { DLSyncEventImpl dlSyncEventImpl = new DLSyncEventImpl(); dlSyncEventImpl.setSyncEventId(getSyncEventId()); dlSyncEventImpl.setCompanyId(getCompanyId()); dlSyncEventImpl.setModifiedTime(getModifiedTime()); dlSyncEventImpl.setEvent(getEvent()); dlSyncEventImpl.setType(getType()); dlSyncEventImpl.setTypePK(getTypePK()); dlSyncEventImpl.resetOriginalValues(); return dlSyncEventImpl; } @Override public int compareTo(DLSyncEvent dlSyncEvent) { int value = 0; if (getModifiedTime() < dlSyncEvent.getModifiedTime()) { value = -1; } else if (getModifiedTime() > dlSyncEvent.getModifiedTime()) { value = 1; } else { value = 0; } if (value != 0) { return value; } return 0; } @Override public boolean equals(Object object) { if (this == object) { return true; } if (!(object instanceof DLSyncEvent)) { return false; } DLSyncEvent dlSyncEvent = (DLSyncEvent)object; long primaryKey = dlSyncEvent.getPrimaryKey(); if (getPrimaryKey() == primaryKey) { return true; } else { return false; } } @Override public int hashCode() { return (int)getPrimaryKey(); } @Override public boolean isEntityCacheEnabled() { return _entityCacheEnabled; } @Override public boolean isFinderCacheEnabled() { return _finderCacheEnabled; } @Override public void resetOriginalValues() { _originalModifiedTime = _modifiedTime; _setOriginalModifiedTime = false; _originalTypePK = _typePK; _setOriginalTypePK = false; _columnBitmask = 0; } @Override public CacheModel toCacheModel() { DLSyncEventCacheModel dlSyncEventCacheModel = new DLSyncEventCacheModel(); dlSyncEventCacheModel.syncEventId = getSyncEventId(); dlSyncEventCacheModel.companyId = getCompanyId(); dlSyncEventCacheModel.modifiedTime = getModifiedTime(); dlSyncEventCacheModel.event = getEvent(); String event = dlSyncEventCacheModel.event; if ((event != null) && (event.length() == 0)) { dlSyncEventCacheModel.event = null; } dlSyncEventCacheModel.type = getType(); String type = dlSyncEventCacheModel.type; if ((type != null) && (type.length() == 0)) { dlSyncEventCacheModel.type = null; } dlSyncEventCacheModel.typePK = getTypePK(); return dlSyncEventCacheModel; } @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((DLSyncEvent)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 = ProxyUtil.getProxyProviderFunction( DLSyncEvent.class, ModelWrapper.class); } private static boolean _entityCacheEnabled; private static boolean _finderCacheEnabled; private long _syncEventId; private long _companyId; private long _modifiedTime; private long _originalModifiedTime; private boolean _setOriginalModifiedTime; private String _event; private String _type; private long _typePK; private long _originalTypePK; private boolean _setOriginalTypePK; private long _columnBitmask; private DLSyncEvent _escapedModel; }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy