/**
* Copyright (c) 2000-present Liferay, Inc. All rights reserved.
*
* This library is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 2.1 of the License, or (at your option)
* any later version.
*
* This library is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
* details.
*/
package com.liferay.portlet.expando.model.impl;
import aQute.bnd.annotation.ProviderType;
import com.liferay.expando.kernel.model.ExpandoRow;
import com.liferay.expando.kernel.model.ExpandoRowModel;
import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.model.CacheModel;
import com.liferay.portal.kernel.model.impl.BaseModelImpl;
import com.liferay.portal.kernel.util.GetterUtil;
import com.liferay.portal.kernel.util.ProxyUtil;
import com.liferay.portal.kernel.util.StringBundler;
import java.io.Serializable;
import java.sql.Types;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
* The base model implementation for the ExpandoRow service. Represents a row in the "ExpandoRow" database table, with each column mapped to a property of this class.
*
* <p>
* This implementation and its corresponding interface {@link ExpandoRowModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link ExpandoRowImpl}.
* </p>
*
* @author Brian Wing Shun Chan
* @see ExpandoRowImpl
* @see ExpandoRow
* @see ExpandoRowModel
* @generated
*/
@ProviderType
public class ExpandoRowModelImpl extends BaseModelImpl<ExpandoRow>
implements ExpandoRowModel {
/*
* NOTE FOR DEVELOPERS:
*
* Never modify or reference this class directly. All methods that expect a expando row model instance should use the {@link ExpandoRow} interface instead.
*/
public static final String TABLE_NAME = "ExpandoRow";
public static final Object[][] TABLE_COLUMNS = {
{ "rowId_", Types.BIGINT },
{ "companyId", Types.BIGINT },
{ "modifiedDate", Types.TIMESTAMP },
{ "tableId", Types.BIGINT },
{ "classPK", Types.BIGINT }
};
public static final Map<String, Integer> TABLE_COLUMNS_MAP = new HashMap<String, Integer>();
static {
TABLE_COLUMNS_MAP.put("rowId_", Types.BIGINT);
TABLE_COLUMNS_MAP.put("companyId", Types.BIGINT);
TABLE_COLUMNS_MAP.put("modifiedDate", Types.TIMESTAMP);
TABLE_COLUMNS_MAP.put("tableId", Types.BIGINT);
TABLE_COLUMNS_MAP.put("classPK", Types.BIGINT);
}
public static final String TABLE_SQL_CREATE = "create table ExpandoRow (rowId_ LONG not null primary key,companyId LONG,modifiedDate DATE null,tableId LONG,classPK LONG)";
public static final String TABLE_SQL_DROP = "drop table ExpandoRow";
public static final String ORDER_BY_JPQL = " ORDER BY expandoRow.rowId ASC";
public static final String ORDER_BY_SQL = " ORDER BY ExpandoRow.rowId_ 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.portal.util.PropsUtil.get(
"value.object.entity.cache.enabled.com.liferay.expando.kernel.model.ExpandoRow"),
true);
public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
"value.object.finder.cache.enabled.com.liferay.expando.kernel.model.ExpandoRow"),
true);
public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
"value.object.column.bitmask.enabled.com.liferay.expando.kernel.model.ExpandoRow"),
true);
public static final long CLASSPK_COLUMN_BITMASK = 1L;
public static final long TABLEID_COLUMN_BITMASK = 2L;
public static final long ROWID_COLUMN_BITMASK = 4L;
public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
"lock.expiration.time.com.liferay.expando.kernel.model.ExpandoRow"));
public ExpandoRowModelImpl() {
}
@Override
public long getPrimaryKey() {
return _rowId;
}
@Override
public void setPrimaryKey(long primaryKey) {
setRowId(primaryKey);
}
@Override
public Serializable getPrimaryKeyObj() {
return _rowId;
}
@Override
public void setPrimaryKeyObj(Serializable primaryKeyObj) {
setPrimaryKey(((Long)primaryKeyObj).longValue());
}
@Override
public Class<?> getModelClass() {
return ExpandoRow.class;
}
@Override
public String getModelClassName() {
return ExpandoRow.class.getName();
}
@Override
public Map<String, Object> getModelAttributes() {
Map<String, Object> attributes = new HashMap<String, Object>();
attributes.put("rowId", getRowId());
attributes.put("companyId", getCompanyId());
attributes.put("modifiedDate", getModifiedDate());
attributes.put("tableId", getTableId());
attributes.put("classPK", getClassPK());
attributes.put("entityCacheEnabled", isEntityCacheEnabled());
attributes.put("finderCacheEnabled", isFinderCacheEnabled());
return attributes;
}
@Override
public void setModelAttributes(Map<String, Object> attributes) {
Long rowId = (Long)attributes.get("rowId");
if (rowId != null) {
setRowId(rowId);
}
Long companyId = (Long)attributes.get("companyId");
if (companyId != null) {
setCompanyId(companyId);
}
Date modifiedDate = (Date)attributes.get("modifiedDate");
if (modifiedDate != null) {
setModifiedDate(modifiedDate);
}
Long tableId = (Long)attributes.get("tableId");
if (tableId != null) {
setTableId(tableId);
}
Long classPK = (Long)attributes.get("classPK");
if (classPK != null) {
setClassPK(classPK);
}
}
@Override
public long getRowId() {
return _rowId;
}
@Override
public void setRowId(long rowId) {
_rowId = rowId;
}
@Override
public long getCompanyId() {
return _companyId;
}
@Override
public void setCompanyId(long companyId) {
_companyId = companyId;
}
@Override
public Date getModifiedDate() {
return _modifiedDate;
}
@Override
public void setModifiedDate(Date modifiedDate) {
_modifiedDate = modifiedDate;
}
@Override
public long getTableId() {
return _tableId;
}
@Override
public void setTableId(long tableId) {
_columnBitmask |= TABLEID_COLUMN_BITMASK;
if (!_setOriginalTableId) {
_setOriginalTableId = true;
_originalTableId = _tableId;
}
_tableId = tableId;
}
public long getOriginalTableId() {
return _originalTableId;
}
@Override
public long getClassPK() {
return _classPK;
}
@Override
public void setClassPK(long classPK) {
_columnBitmask |= CLASSPK_COLUMN_BITMASK;
if (!_setOriginalClassPK) {
_setOriginalClassPK = true;
_originalClassPK = _classPK;
}
_classPK = classPK;
}
public long getOriginalClassPK() {
return _originalClassPK;
}
public long getColumnBitmask() {
return _columnBitmask;
}
@Override
public ExpandoRow toEscapedModel() {
if (_escapedModel == null) {
_escapedModel = (ExpandoRow)ProxyUtil.newProxyInstance(_classLoader,
_escapedModelInterfaces, new AutoEscapeBeanHandler(this));
}
return _escapedModel;
}
@Override
public Object clone() {
ExpandoRowImpl expandoRowImpl = new ExpandoRowImpl();
expandoRowImpl.setRowId(getRowId());
expandoRowImpl.setCompanyId(getCompanyId());
expandoRowImpl.setModifiedDate(getModifiedDate());
expandoRowImpl.setTableId(getTableId());
expandoRowImpl.setClassPK(getClassPK());
expandoRowImpl.resetOriginalValues();
return expandoRowImpl;
}
@Override
public int compareTo(ExpandoRow expandoRow) {
long primaryKey = expandoRow.getPrimaryKey();
if (getPrimaryKey() < primaryKey) {
return -1;
}
else if (getPrimaryKey() > primaryKey) {
return 1;
}
else {
return 0;
}
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (!(obj instanceof ExpandoRow)) {
return false;
}
ExpandoRow expandoRow = (ExpandoRow)obj;
long primaryKey = expandoRow.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() {
ExpandoRowModelImpl expandoRowModelImpl = this;
expandoRowModelImpl._originalTableId = expandoRowModelImpl._tableId;
expandoRowModelImpl._setOriginalTableId = false;
expandoRowModelImpl._originalClassPK = expandoRowModelImpl._classPK;
expandoRowModelImpl._setOriginalClassPK = false;
expandoRowModelImpl._columnBitmask = 0;
}
@Override
public CacheModel<ExpandoRow> toCacheModel() {
ExpandoRowCacheModel expandoRowCacheModel = new ExpandoRowCacheModel();
expandoRowCacheModel.rowId = getRowId();
expandoRowCacheModel.companyId = getCompanyId();
Date modifiedDate = getModifiedDate();
if (modifiedDate != null) {
expandoRowCacheModel.modifiedDate = modifiedDate.getTime();
}
else {
expandoRowCacheModel.modifiedDate = Long.MIN_VALUE;
}
expandoRowCacheModel.tableId = getTableId();
expandoRowCacheModel.classPK = getClassPK();
return expandoRowCacheModel;
}
@Override
public String toString() {
StringBundler sb = new StringBundler(11);
sb.append("{rowId=");
sb.append(getRowId());
sb.append(", companyId=");
sb.append(getCompanyId());
sb.append(", modifiedDate=");
sb.append(getModifiedDate());
sb.append(", tableId=");
sb.append(getTableId());
sb.append(", classPK=");
sb.append(getClassPK());
sb.append("}");
return sb.toString();
}
@Override
public String toXmlString() {
StringBundler sb = new StringBundler(19);
sb.append("<model><model-name>");
sb.append("com.liferay.expando.kernel.model.ExpandoRow");
sb.append("</model-name>");
sb.append(
"<column><column-name>rowId</column-name><column-value><![CDATA[");
sb.append(getRowId());
sb.append("]]></column-value></column>");
sb.append(
"<column><column-name>companyId</column-name><column-value><![CDATA[");
sb.append(getCompanyId());
sb.append("]]></column-value></column>");
sb.append(
"<column><column-name>modifiedDate</column-name><column-value><![CDATA[");
sb.append(getModifiedDate());
sb.append("]]></column-value></column>");
sb.append(
"<column><column-name>tableId</column-name><column-value><![CDATA[");
sb.append(getTableId());
sb.append("]]></column-value></column>");
sb.append(
"<column><column-name>classPK</column-name><column-value><![CDATA[");
sb.append(getClassPK());
sb.append("]]></column-value></column>");
sb.append("</model>");
return sb.toString();
}
private static final ClassLoader _classLoader = ExpandoRow.class.getClassLoader();
private static final Class<?>[] _escapedModelInterfaces = new Class[] {
ExpandoRow.class
};
private long _rowId;
private long _companyId;
private Date _modifiedDate;
private long _tableId;
private long _originalTableId;
private boolean _setOriginalTableId;
private long _classPK;
private long _originalClassPK;
private boolean _setOriginalClassPK;
private long _columnBitmask;
private ExpandoRow _escapedModel;
}