/**
* 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.roster.model.impl;
import aQute.bnd.annotation.ProviderType;
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.json.JSON;
import com.liferay.portal.kernel.model.CacheModel;
import com.liferay.portal.kernel.model.impl.BaseModelImpl;
import com.liferay.portal.kernel.service.ServiceContext;
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.roster.model.Club;
import com.liferay.roster.model.ClubModel;
import com.liferay.roster.model.ClubSoap;
import java.io.Serializable;
import java.sql.Types;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* The base model implementation for the Club service. Represents a row in the "ROSTER_Club" database table, with each column mapped to a property of this class.
*
* <p>
* This implementation and its corresponding interface {@link ClubModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link ClubImpl}.
* </p>
*
* @author Brian Wing Shun Chan
* @see ClubImpl
* @see Club
* @see ClubModel
* @generated
*/
@JSON(strict = true)
@ProviderType
public class ClubModelImpl extends BaseModelImpl<Club> implements ClubModel {
/*
* NOTE FOR DEVELOPERS:
*
* Never modify or reference this class directly. All methods that expect a club model instance should use the {@link Club} interface instead.
*/
public static final String TABLE_NAME = "ROSTER_Club";
public static final Object[][] TABLE_COLUMNS = {
{ "uuid_", Types.VARCHAR },
{ "clubId", Types.BIGINT },
{ "createDate", Types.TIMESTAMP },
{ "modifiedDate", Types.TIMESTAMP },
{ "name", Types.VARCHAR }
};
public static final Map<String, Integer> TABLE_COLUMNS_MAP = new HashMap<String, Integer>();
static {
TABLE_COLUMNS_MAP.put("uuid_", Types.VARCHAR);
TABLE_COLUMNS_MAP.put("clubId", Types.BIGINT);
TABLE_COLUMNS_MAP.put("createDate", Types.TIMESTAMP);
TABLE_COLUMNS_MAP.put("modifiedDate", Types.TIMESTAMP);
TABLE_COLUMNS_MAP.put("name", Types.VARCHAR);
}
public static final String TABLE_SQL_CREATE = "create table ROSTER_Club (uuid_ VARCHAR(75) null,clubId LONG not null primary key,createDate DATE null,modifiedDate DATE null,name VARCHAR(75) null)";
public static final String TABLE_SQL_DROP = "drop table ROSTER_Club";
public static final String ORDER_BY_JPQL = " ORDER BY club.clubId ASC";
public static final String ORDER_BY_SQL = " ORDER BY ROSTER_Club.clubId 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.roster.service.util.PropsUtil.get(
"value.object.entity.cache.enabled.com.liferay.roster.model.Club"),
true);
public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.roster.service.util.PropsUtil.get(
"value.object.finder.cache.enabled.com.liferay.roster.model.Club"),
true);
public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.roster.service.util.PropsUtil.get(
"value.object.column.bitmask.enabled.com.liferay.roster.model.Club"),
true);
public static final long UUID_COLUMN_BITMASK = 1L;
public static final long CLUBID_COLUMN_BITMASK = 2L;
/**
* Converts the soap model instance into a normal model instance.
*
* @param soapModel the soap model instance to convert
* @return the normal model instance
*/
public static Club toModel(ClubSoap soapModel) {
if (soapModel == null) {
return null;
}
Club model = new ClubImpl();
model.setUuid(soapModel.getUuid());
model.setClubId(soapModel.getClubId());
model.setCreateDate(soapModel.getCreateDate());
model.setModifiedDate(soapModel.getModifiedDate());
model.setName(soapModel.getName());
return model;
}
/**
* Converts the soap model instances into normal model instances.
*
* @param soapModels the soap model instances to convert
* @return the normal model instances
*/
public static List<Club> toModels(ClubSoap[] soapModels) {
if (soapModels == null) {
return null;
}
List<Club> models = new ArrayList<Club>(soapModels.length);
for (ClubSoap soapModel : soapModels) {
models.add(toModel(soapModel));
}
return models;
}
public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.roster.service.util.PropsUtil.get(
"lock.expiration.time.com.liferay.roster.model.Club"));
public ClubModelImpl() {
}
@Override
public long getPrimaryKey() {
return _clubId;
}
@Override
public void setPrimaryKey(long primaryKey) {
setClubId(primaryKey);
}
@Override
public Serializable getPrimaryKeyObj() {
return _clubId;
}
@Override
public void setPrimaryKeyObj(Serializable primaryKeyObj) {
setPrimaryKey(((Long)primaryKeyObj).longValue());
}
@Override
public Class<?> getModelClass() {
return Club.class;
}
@Override
public String getModelClassName() {
return Club.class.getName();
}
@Override
public Map<String, Object> getModelAttributes() {
Map<String, Object> attributes = new HashMap<String, Object>();
attributes.put("uuid", getUuid());
attributes.put("clubId", getClubId());
attributes.put("createDate", getCreateDate());
attributes.put("modifiedDate", getModifiedDate());
attributes.put("name", getName());
attributes.put("entityCacheEnabled", isEntityCacheEnabled());
attributes.put("finderCacheEnabled", isFinderCacheEnabled());
return attributes;
}
@Override
public void setModelAttributes(Map<String, Object> attributes) {
String uuid = (String)attributes.get("uuid");
if (uuid != null) {
setUuid(uuid);
}
Long clubId = (Long)attributes.get("clubId");
if (clubId != null) {
setClubId(clubId);
}
Date createDate = (Date)attributes.get("createDate");
if (createDate != null) {
setCreateDate(createDate);
}
Date modifiedDate = (Date)attributes.get("modifiedDate");
if (modifiedDate != null) {
setModifiedDate(modifiedDate);
}
String name = (String)attributes.get("name");
if (name != null) {
setName(name);
}
}
@JSON
@Override
public String getUuid() {
if (_uuid == null) {
return StringPool.BLANK;
}
else {
return _uuid;
}
}
@Override
public void setUuid(String uuid) {
if (_originalUuid == null) {
_originalUuid = _uuid;
}
_uuid = uuid;
}
public String getOriginalUuid() {
return GetterUtil.getString(_originalUuid);
}
@JSON
@Override
public long getClubId() {
return _clubId;
}
@Override
public void setClubId(long clubId) {
_clubId = clubId;
}
@JSON
@Override
public Date getCreateDate() {
return _createDate;
}
@Override
public void setCreateDate(Date createDate) {
_createDate = createDate;
}
@JSON
@Override
public Date getModifiedDate() {
return _modifiedDate;
}
public boolean hasSetModifiedDate() {
return _setModifiedDate;
}
@Override
public void setModifiedDate(Date modifiedDate) {
_setModifiedDate = true;
_modifiedDate = modifiedDate;
}
@JSON
@Override
public String getName() {
if (_name == null) {
return StringPool.BLANK;
}
else {
return _name;
}
}
@Override
public void setName(String name) {
_name = name;
}
public long getColumnBitmask() {
return _columnBitmask;
}
@Override
public ExpandoBridge getExpandoBridge() {
return ExpandoBridgeFactoryUtil.getExpandoBridge(0,
Club.class.getName(), getPrimaryKey());
}
@Override
public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
ExpandoBridge expandoBridge = getExpandoBridge();
expandoBridge.setAttributes(serviceContext);
}
@Override
public Club toEscapedModel() {
if (_escapedModel == null) {
_escapedModel = (Club)ProxyUtil.newProxyInstance(_classLoader,
_escapedModelInterfaces, new AutoEscapeBeanHandler(this));
}
return _escapedModel;
}
@Override
public Object clone() {
ClubImpl clubImpl = new ClubImpl();
clubImpl.setUuid(getUuid());
clubImpl.setClubId(getClubId());
clubImpl.setCreateDate(getCreateDate());
clubImpl.setModifiedDate(getModifiedDate());
clubImpl.setName(getName());
clubImpl.resetOriginalValues();
return clubImpl;
}
@Override
public int compareTo(Club club) {
long primaryKey = club.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 Club)) {
return false;
}
Club club = (Club)obj;
long primaryKey = club.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() {
ClubModelImpl clubModelImpl = this;
clubModelImpl._originalUuid = clubModelImpl._uuid;
clubModelImpl._setModifiedDate = false;
clubModelImpl._columnBitmask = 0;
}
@Override
public CacheModel<Club> toCacheModel() {
ClubCacheModel clubCacheModel = new ClubCacheModel();
clubCacheModel.uuid = getUuid();
String uuid = clubCacheModel.uuid;
if ((uuid != null) && (uuid.length() == 0)) {
clubCacheModel.uuid = null;
}
clubCacheModel.clubId = getClubId();
Date createDate = getCreateDate();
if (createDate != null) {
clubCacheModel.createDate = createDate.getTime();
}
else {
clubCacheModel.createDate = Long.MIN_VALUE;
}
Date modifiedDate = getModifiedDate();
if (modifiedDate != null) {
clubCacheModel.modifiedDate = modifiedDate.getTime();
}
else {
clubCacheModel.modifiedDate = Long.MIN_VALUE;
}
clubCacheModel.name = getName();
String name = clubCacheModel.name;
if ((name != null) && (name.length() == 0)) {
clubCacheModel.name = null;
}
return clubCacheModel;
}
@Override
public String toString() {
StringBundler sb = new StringBundler(11);
sb.append("{uuid=");
sb.append(getUuid());
sb.append(", clubId=");
sb.append(getClubId());
sb.append(", createDate=");
sb.append(getCreateDate());
sb.append(", modifiedDate=");
sb.append(getModifiedDate());
sb.append(", name=");
sb.append(getName());
sb.append("}");
return sb.toString();
}
@Override
public String toXmlString() {
StringBundler sb = new StringBundler(19);
sb.append("<model><model-name>");
sb.append("com.liferay.roster.model.Club");
sb.append("</model-name>");
sb.append(
"<column><column-name>uuid</column-name><column-value><![CDATA[");
sb.append(getUuid());
sb.append("]]></column-value></column>");
sb.append(
"<column><column-name>clubId</column-name><column-value><![CDATA[");
sb.append(getClubId());
sb.append("]]></column-value></column>");
sb.append(
"<column><column-name>createDate</column-name><column-value><![CDATA[");
sb.append(getCreateDate());
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>name</column-name><column-value><![CDATA[");
sb.append(getName());
sb.append("]]></column-value></column>");
sb.append("</model>");
return sb.toString();
}
private static final ClassLoader _classLoader = Club.class.getClassLoader();
private static final Class<?>[] _escapedModelInterfaces = new Class[] {
Club.class
};
private String _uuid;
private String _originalUuid;
private long _clubId;
private Date _createDate;
private Date _modifiedDate;
private boolean _setModifiedDate;
private String _name;
private long _columnBitmask;
private Club _escapedModel;
}