com.liferay.portal.model.impl.ShardModelImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of portal-impl Show documentation
Show all versions of portal-impl Show documentation
Contains implementation for the portal services.
/**
* Copyright (c) 2000-2013 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.portal.model.impl;
import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
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.StringPool;
import com.liferay.portal.kernel.util.Validator;
import com.liferay.portal.model.CacheModel;
import com.liferay.portal.model.Shard;
import com.liferay.portal.model.ShardModel;
import com.liferay.portal.service.ServiceContext;
import com.liferay.portal.util.PortalUtil;
import com.liferay.portlet.expando.model.ExpandoBridge;
import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
import java.io.Serializable;
import java.sql.Types;
import java.util.HashMap;
import java.util.Map;
/**
* The base model implementation for the Shard service. Represents a row in the "Shard" database table, with each column mapped to a property of this class.
*
*
* This implementation and its corresponding interface {@link com.liferay.portal.model.ShardModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link ShardImpl}.
*
*
* @author Brian Wing Shun Chan
* @see ShardImpl
* @see com.liferay.portal.model.Shard
* @see com.liferay.portal.model.ShardModel
* @generated
*/
public class ShardModelImpl extends BaseModelImpl implements ShardModel {
/*
* NOTE FOR DEVELOPERS:
*
* Never modify or reference this class directly. All methods that expect a shard model instance should use the {@link com.liferay.portal.model.Shard} interface instead.
*/
public static final String TABLE_NAME = "Shard";
public static final Object[][] TABLE_COLUMNS = {
{ "shardId", Types.BIGINT },
{ "classNameId", Types.BIGINT },
{ "classPK", Types.BIGINT },
{ "name", Types.VARCHAR }
};
public static final String TABLE_SQL_CREATE = "create table Shard (shardId LONG not null primary key,classNameId LONG,classPK LONG,name VARCHAR(75) null)";
public static final String TABLE_SQL_DROP = "drop table Shard";
public static final String ORDER_BY_JPQL = " ORDER BY shard.shardId ASC";
public static final String ORDER_BY_SQL = " ORDER BY Shard.shardId 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.portal.model.Shard"),
true);
public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
"value.object.finder.cache.enabled.com.liferay.portal.model.Shard"),
true);
public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
"value.object.column.bitmask.enabled.com.liferay.portal.model.Shard"),
true);
public static long CLASSNAMEID_COLUMN_BITMASK = 1L;
public static long CLASSPK_COLUMN_BITMASK = 2L;
public static long NAME_COLUMN_BITMASK = 4L;
public static long SHARDID_COLUMN_BITMASK = 8L;
public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
"lock.expiration.time.com.liferay.portal.model.Shard"));
public ShardModelImpl() {
}
@Override
public long getPrimaryKey() {
return _shardId;
}
@Override
public void setPrimaryKey(long primaryKey) {
setShardId(primaryKey);
}
@Override
public Serializable getPrimaryKeyObj() {
return _shardId;
}
@Override
public void setPrimaryKeyObj(Serializable primaryKeyObj) {
setPrimaryKey(((Long)primaryKeyObj).longValue());
}
@Override
public Class getModelClass() {
return Shard.class;
}
@Override
public String getModelClassName() {
return Shard.class.getName();
}
@Override
public Map getModelAttributes() {
Map attributes = new HashMap();
attributes.put("shardId", getShardId());
attributes.put("classNameId", getClassNameId());
attributes.put("classPK", getClassPK());
attributes.put("name", getName());
return attributes;
}
@Override
public void setModelAttributes(Map attributes) {
Long shardId = (Long)attributes.get("shardId");
if (shardId != null) {
setShardId(shardId);
}
Long classNameId = (Long)attributes.get("classNameId");
if (classNameId != null) {
setClassNameId(classNameId);
}
Long classPK = (Long)attributes.get("classPK");
if (classPK != null) {
setClassPK(classPK);
}
String name = (String)attributes.get("name");
if (name != null) {
setName(name);
}
}
@Override
public long getShardId() {
return _shardId;
}
@Override
public void setShardId(long shardId) {
_shardId = shardId;
}
@Override
public String getClassName() {
if (getClassNameId() <= 0) {
return StringPool.BLANK;
}
return PortalUtil.getClassName(getClassNameId());
}
@Override
public void setClassName(String className) {
long classNameId = 0;
if (Validator.isNotNull(className)) {
classNameId = PortalUtil.getClassNameId(className);
}
setClassNameId(classNameId);
}
@Override
public long getClassNameId() {
return _classNameId;
}
@Override
public void setClassNameId(long classNameId) {
_columnBitmask |= CLASSNAMEID_COLUMN_BITMASK;
if (!_setOriginalClassNameId) {
_setOriginalClassNameId = true;
_originalClassNameId = _classNameId;
}
_classNameId = classNameId;
}
public long getOriginalClassNameId() {
return _originalClassNameId;
}
@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;
}
@Override
public String getName() {
if (_name == null) {
return StringPool.BLANK;
}
else {
return _name;
}
}
@Override
public void setName(String name) {
_columnBitmask |= NAME_COLUMN_BITMASK;
if (_originalName == null) {
_originalName = _name;
}
_name = name;
}
public String getOriginalName() {
return GetterUtil.getString(_originalName);
}
public long getColumnBitmask() {
return _columnBitmask;
}
@Override
public ExpandoBridge getExpandoBridge() {
return ExpandoBridgeFactoryUtil.getExpandoBridge(0,
Shard.class.getName(), getPrimaryKey());
}
@Override
public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
ExpandoBridge expandoBridge = getExpandoBridge();
expandoBridge.setAttributes(serviceContext);
}
@Override
public Shard toEscapedModel() {
if (_escapedModel == null) {
_escapedModel = (Shard)ProxyUtil.newProxyInstance(_classLoader,
_escapedModelInterfaces, new AutoEscapeBeanHandler(this));
}
return _escapedModel;
}
@Override
public Object clone() {
ShardImpl shardImpl = new ShardImpl();
shardImpl.setShardId(getShardId());
shardImpl.setClassNameId(getClassNameId());
shardImpl.setClassPK(getClassPK());
shardImpl.setName(getName());
shardImpl.resetOriginalValues();
return shardImpl;
}
@Override
public int compareTo(Shard shard) {
long primaryKey = shard.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 Shard)) {
return false;
}
Shard shard = (Shard)obj;
long primaryKey = shard.getPrimaryKey();
if (getPrimaryKey() == primaryKey) {
return true;
}
else {
return false;
}
}
@Override
public int hashCode() {
return (int)getPrimaryKey();
}
@Override
public void resetOriginalValues() {
ShardModelImpl shardModelImpl = this;
shardModelImpl._originalClassNameId = shardModelImpl._classNameId;
shardModelImpl._setOriginalClassNameId = false;
shardModelImpl._originalClassPK = shardModelImpl._classPK;
shardModelImpl._setOriginalClassPK = false;
shardModelImpl._originalName = shardModelImpl._name;
shardModelImpl._columnBitmask = 0;
}
@Override
public CacheModel toCacheModel() {
ShardCacheModel shardCacheModel = new ShardCacheModel();
shardCacheModel.shardId = getShardId();
shardCacheModel.classNameId = getClassNameId();
shardCacheModel.classPK = getClassPK();
shardCacheModel.name = getName();
String name = shardCacheModel.name;
if ((name != null) && (name.length() == 0)) {
shardCacheModel.name = null;
}
return shardCacheModel;
}
@Override
public String toString() {
StringBundler sb = new StringBundler(9);
sb.append("{shardId=");
sb.append(getShardId());
sb.append(", classNameId=");
sb.append(getClassNameId());
sb.append(", classPK=");
sb.append(getClassPK());
sb.append(", name=");
sb.append(getName());
sb.append("}");
return sb.toString();
}
@Override
public String toXmlString() {
StringBundler sb = new StringBundler(16);
sb.append("");
sb.append("com.liferay.portal.model.Shard");
sb.append(" ");
sb.append(
"shardId ");
sb.append(
"classNameId ");
sb.append(
"classPK ");
sb.append(
"name ");
sb.append(" ");
return sb.toString();
}
private static ClassLoader _classLoader = Shard.class.getClassLoader();
private static Class[] _escapedModelInterfaces = new Class[] { Shard.class };
private long _shardId;
private long _classNameId;
private long _originalClassNameId;
private boolean _setOriginalClassNameId;
private long _classPK;
private long _originalClassPK;
private boolean _setOriginalClassPK;
private String _name;
private String _originalName;
private long _columnBitmask;
private Shard _escapedModel;
}