/** * 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.Roster; import com.liferay.roster.model.RosterModel; import com.liferay.roster.model.RosterSoap; 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 Roster service. Represents a row in the "ROSTER_Roster" database table, with each column mapped to a property of this class. * * <p> * This implementation and its corresponding interface {@link RosterModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link RosterImpl}. * </p> * * @author Brian Wing Shun Chan * @see RosterImpl * @see Roster * @see RosterModel * @generated */ @JSON(strict = true) @ProviderType public class RosterModelImpl extends BaseModelImpl<Roster> implements RosterModel { /* * NOTE FOR DEVELOPERS: * * Never modify or reference this class directly. All methods that expect a roster model instance should use the {@link Roster} interface instead. */ public static final String TABLE_NAME = "ROSTER_Roster"; public static final Object[][] TABLE_COLUMNS = { { "uuid_", Types.VARCHAR }, { "rosterId", Types.BIGINT }, { "createDate", Types.TIMESTAMP }, { "modifiedDate", Types.TIMESTAMP }, { "clubId", Types.BIGINT }, { "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("rosterId", Types.BIGINT); TABLE_COLUMNS_MAP.put("createDate", Types.TIMESTAMP); TABLE_COLUMNS_MAP.put("modifiedDate", Types.TIMESTAMP); TABLE_COLUMNS_MAP.put("clubId", Types.BIGINT); TABLE_COLUMNS_MAP.put("name", Types.VARCHAR); } public static final String TABLE_SQL_CREATE = "create table ROSTER_Roster (uuid_ VARCHAR(75) null,rosterId LONG not null primary key,createDate DATE null,modifiedDate DATE null,clubId LONG,name VARCHAR(75) null)"; public static final String TABLE_SQL_DROP = "drop table ROSTER_Roster"; public static final String ORDER_BY_JPQL = " ORDER BY roster.rosterId ASC"; public static final String ORDER_BY_SQL = " ORDER BY ROSTER_Roster.rosterId 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.Roster"), 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.Roster"), 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.Roster"), true); public static final long CLUBID_COLUMN_BITMASK = 1L; public static final long UUID_COLUMN_BITMASK = 2L; public static final long ROSTERID_COLUMN_BITMASK = 4L; /** * 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 Roster toModel(RosterSoap soapModel) { if (soapModel == null) { return null; } Roster model = new RosterImpl(); model.setUuid(soapModel.getUuid()); model.setRosterId(soapModel.getRosterId()); model.setCreateDate(soapModel.getCreateDate()); model.setModifiedDate(soapModel.getModifiedDate()); model.setClubId(soapModel.getClubId()); 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<Roster> toModels(RosterSoap[] soapModels) { if (soapModels == null) { return null; } List<Roster> models = new ArrayList<Roster>(soapModels.length); for (RosterSoap 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.Roster")); public RosterModelImpl() { } @Override public long getPrimaryKey() { return _rosterId; } @Override public void setPrimaryKey(long primaryKey) { setRosterId(primaryKey); } @Override public Serializable getPrimaryKeyObj() { return _rosterId; } @Override public void setPrimaryKeyObj(Serializable primaryKeyObj) { setPrimaryKey(((Long)primaryKeyObj).longValue()); } @Override public Class<?> getModelClass() { return Roster.class; } @Override public String getModelClassName() { return Roster.class.getName(); } @Override public Map<String, Object> getModelAttributes() { Map<String, Object> attributes = new HashMap<String, Object>(); attributes.put("uuid", getUuid()); attributes.put("rosterId", getRosterId()); attributes.put("createDate", getCreateDate()); attributes.put("modifiedDate", getModifiedDate()); attributes.put("clubId", getClubId()); 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 rosterId = (Long)attributes.get("rosterId"); if (rosterId != null) { setRosterId(rosterId); } Date createDate = (Date)attributes.get("createDate"); if (createDate != null) { setCreateDate(createDate); } Date modifiedDate = (Date)attributes.get("modifiedDate"); if (modifiedDate != null) { setModifiedDate(modifiedDate); } Long clubId = (Long)attributes.get("clubId"); if (clubId != null) { setClubId(clubId); } 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 getRosterId() { return _rosterId; } @Override public void setRosterId(long rosterId) { _rosterId = rosterId; } @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 long getClubId() { return _clubId; } @Override public void setClubId(long clubId) { _columnBitmask |= CLUBID_COLUMN_BITMASK; if (!_setOriginalClubId) { _setOriginalClubId = true; _originalClubId = _clubId; } _clubId = clubId; } public long getOriginalClubId() { return _originalClubId; } @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, Roster.class.getName(), getPrimaryKey()); } @Override public void setExpandoBridgeAttributes(ServiceContext serviceContext) { ExpandoBridge expandoBridge = getExpandoBridge(); expandoBridge.setAttributes(serviceContext); } @Override public Roster toEscapedModel() { if (_escapedModel == null) { _escapedModel = (Roster)ProxyUtil.newProxyInstance(_classLoader, _escapedModelInterfaces, new AutoEscapeBeanHandler(this)); } return _escapedModel; } @Override public Object clone() { RosterImpl rosterImpl = new RosterImpl(); rosterImpl.setUuid(getUuid()); rosterImpl.setRosterId(getRosterId()); rosterImpl.setCreateDate(getCreateDate()); rosterImpl.setModifiedDate(getModifiedDate()); rosterImpl.setClubId(getClubId()); rosterImpl.setName(getName()); rosterImpl.resetOriginalValues(); return rosterImpl; } @Override public int compareTo(Roster roster) { long primaryKey = roster.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 Roster)) { return false; } Roster roster = (Roster)obj; long primaryKey = roster.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() { RosterModelImpl rosterModelImpl = this; rosterModelImpl._originalUuid = rosterModelImpl._uuid; rosterModelImpl._setModifiedDate = false; rosterModelImpl._originalClubId = rosterModelImpl._clubId; rosterModelImpl._setOriginalClubId = false; rosterModelImpl._columnBitmask = 0; } @Override public CacheModel<Roster> toCacheModel() { RosterCacheModel rosterCacheModel = new RosterCacheModel(); rosterCacheModel.uuid = getUuid(); String uuid = rosterCacheModel.uuid; if ((uuid != null) && (uuid.length() == 0)) { rosterCacheModel.uuid = null; } rosterCacheModel.rosterId = getRosterId(); Date createDate = getCreateDate(); if (createDate != null) { rosterCacheModel.createDate = createDate.getTime(); } else { rosterCacheModel.createDate = Long.MIN_VALUE; } Date modifiedDate = getModifiedDate(); if (modifiedDate != null) { rosterCacheModel.modifiedDate = modifiedDate.getTime(); } else { rosterCacheModel.modifiedDate = Long.MIN_VALUE; } rosterCacheModel.clubId = getClubId(); rosterCacheModel.name = getName(); String name = rosterCacheModel.name; if ((name != null) && (name.length() == 0)) { rosterCacheModel.name = null; } return rosterCacheModel; } @Override public String toString() { StringBundler sb = new StringBundler(13); sb.append("{uuid="); sb.append(getUuid()); sb.append(", rosterId="); sb.append(getRosterId()); sb.append(", createDate="); sb.append(getCreateDate()); sb.append(", modifiedDate="); sb.append(getModifiedDate()); sb.append(", clubId="); sb.append(getClubId()); sb.append(", name="); sb.append(getName()); sb.append("}"); return sb.toString(); } @Override public String toXmlString() { StringBundler sb = new StringBundler(22); sb.append("<model><model-name>"); sb.append("com.liferay.roster.model.Roster"); 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>rosterId</column-name><column-value><![CDATA["); sb.append(getRosterId()); 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>clubId</column-name><column-value><![CDATA["); sb.append(getClubId()); 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 = Roster.class.getClassLoader(); private static final Class<?>[] _escapedModelInterfaces = new Class[] { Roster.class }; private String _uuid; private String _originalUuid; private long _rosterId; private Date _createDate; private Date _modifiedDate; private boolean _setModifiedDate; private long _clubId; private long _originalClubId; private boolean _setOriginalClubId; private String _name; private long _columnBitmask; private Roster _escapedModel; }