/**
* Copyright (c) 2009-2014 Câmara dos Deputados. Todos os direitos reservados.
*
* e-Democracia é um software livre; você pode redistribuí-lo e/ou modificá-lo dentro
* dos termos da Licença Pública Geral Menor GNU como publicada pela Fundação do
* Software Livre (FSF); na versão 2.1 da Licença, ou (na sua opinião) qualquer versão.
*
* Este programa é distribuído na esperança de que possa ser útil, mas SEM NENHUMA GARANTIA;
* sem uma garantia implícita de ADEQUAÇÃO a qualquer MERCADO ou APLICAÇÃO EM PARTICULAR.
* Veja a Licença Pública Geral Menor GNU para maiores detalhes.
*/
package br.gov.camara.edemocracia.portlets.chat.model.impl;
import br.gov.camara.edemocracia.portlets.chat.model.ChatRoomTwitter;
import br.gov.camara.edemocracia.portlets.chat.model.ChatRoomTwitterModel;
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.model.CacheModel;
import com.liferay.portal.model.impl.BaseModelImpl;
import com.liferay.portal.service.ServiceContext;
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 ChatRoomTwitter service. Represents a row in the "CDChat_ChatRoomTwitter" database table, with each column mapped to a property of this class.
*
* <p>
* This implementation and its corresponding interface {@link br.gov.camara.edemocracia.portlets.chat.model.ChatRoomTwitterModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link ChatRoomTwitterImpl}.
* </p>
*
* @author Ricardo Lima
* @see ChatRoomTwitterImpl
* @see br.gov.camara.edemocracia.portlets.chat.model.ChatRoomTwitter
* @see br.gov.camara.edemocracia.portlets.chat.model.ChatRoomTwitterModel
* @generated
*/
public class ChatRoomTwitterModelImpl extends BaseModelImpl<ChatRoomTwitter>
implements ChatRoomTwitterModel {
/*
* NOTE FOR DEVELOPERS:
*
* Never modify or reference this class directly. All methods that expect a chat room twitter model instance should use the {@link br.gov.camara.edemocracia.portlets.chat.model.ChatRoomTwitter} interface instead.
*/
public static final String TABLE_NAME = "CDChat_ChatRoomTwitter";
public static final Object[][] TABLE_COLUMNS = {
{ "twitterId", Types.BIGINT },
{ "twitterTitle", Types.VARCHAR },
{ "twitterDescription", Types.VARCHAR },
{ "twitterEnabled", Types.BOOLEAN },
{ "twitterHashtag", Types.VARCHAR },
{ "twitterDataWidgetId", Types.VARCHAR }
};
public static final String TABLE_SQL_CREATE = "create table CDChat_ChatRoomTwitter (twitterId LONG not null primary key,twitterTitle VARCHAR(75) null,twitterDescription VARCHAR(3900) null,twitterEnabled BOOLEAN,twitterHashtag VARCHAR(75) null,twitterDataWidgetId VARCHAR(75) null)";
public static final String TABLE_SQL_DROP = "drop table CDChat_ChatRoomTwitter";
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.util.service.ServiceProps.get(
"value.object.entity.cache.enabled.br.gov.camara.edemocracia.portlets.chat.model.ChatRoomTwitter"),
true);
public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
"value.object.finder.cache.enabled.br.gov.camara.edemocracia.portlets.chat.model.ChatRoomTwitter"),
true);
public static final boolean COLUMN_BITMASK_ENABLED = false;
public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get(
"lock.expiration.time.br.gov.camara.edemocracia.portlets.chat.model.ChatRoomTwitter"));
private static ClassLoader _classLoader = ChatRoomTwitter.class.getClassLoader();
private static Class<?>[] _escapedModelProxyInterfaces = new Class[] {
ChatRoomTwitter.class
};
private long _twitterId;
private String _twitterTitle;
private String _twitterDescription;
private boolean _twitterEnabled;
private String _twitterHashtag;
private String _twitterDataWidgetId;
private ChatRoomTwitter _escapedModelProxy;
public ChatRoomTwitterModelImpl() {
}
public long getPrimaryKey() {
return _twitterId;
}
public void setPrimaryKey(long primaryKey) {
setTwitterId(primaryKey);
}
public Serializable getPrimaryKeyObj() {
return new Long(_twitterId);
}
public void setPrimaryKeyObj(Serializable primaryKeyObj) {
setPrimaryKey(((Long) primaryKeyObj).longValue());
}
public Class<?> getModelClass() {
return ChatRoomTwitter.class;
}
public String getModelClassName() {
return ChatRoomTwitter.class.getName();
}
@Override
public Map<String, Object> getModelAttributes() {
Map<String, Object> attributes = new HashMap<String, Object>();
attributes.put("twitterId", getTwitterId());
attributes.put("twitterTitle", getTwitterTitle());
attributes.put("twitterDescription", getTwitterDescription());
attributes.put("twitterEnabled", getTwitterEnabled());
attributes.put("twitterHashtag", getTwitterHashtag());
attributes.put("twitterDataWidgetId", getTwitterDataWidgetId());
return attributes;
}
@Override
public void setModelAttributes(Map<String, Object> attributes) {
Long twitterId = (Long) attributes.get("twitterId");
if (twitterId != null) {
setTwitterId(twitterId);
}
String twitterTitle = (String) attributes.get("twitterTitle");
if (twitterTitle != null) {
setTwitterTitle(twitterTitle);
}
String twitterDescription = (String) attributes.get(
"twitterDescription");
if (twitterDescription != null) {
setTwitterDescription(twitterDescription);
}
Boolean twitterEnabled = (Boolean) attributes.get("twitterEnabled");
if (twitterEnabled != null) {
setTwitterEnabled(twitterEnabled);
}
String twitterHashtag = (String) attributes.get("twitterHashtag");
if (twitterHashtag != null) {
setTwitterHashtag(twitterHashtag);
}
String twitterDataWidgetId = (String) attributes.get(
"twitterDataWidgetId");
if (twitterDataWidgetId != null) {
setTwitterDataWidgetId(twitterDataWidgetId);
}
}
public long getTwitterId() {
return _twitterId;
}
public void setTwitterId(long twitterId) {
_twitterId = twitterId;
}
public String getTwitterTitle() {
if (_twitterTitle == null) {
return StringPool.BLANK;
} else {
return _twitterTitle;
}
}
public void setTwitterTitle(String twitterTitle) {
_twitterTitle = twitterTitle;
}
public String getTwitterDescription() {
if (_twitterDescription == null) {
return StringPool.BLANK;
} else {
return _twitterDescription;
}
}
public void setTwitterDescription(String twitterDescription) {
_twitterDescription = twitterDescription;
}
public boolean getTwitterEnabled() {
return _twitterEnabled;
}
public boolean isTwitterEnabled() {
return _twitterEnabled;
}
public void setTwitterEnabled(boolean twitterEnabled) {
_twitterEnabled = twitterEnabled;
}
public String getTwitterHashtag() {
if (_twitterHashtag == null) {
return StringPool.BLANK;
} else {
return _twitterHashtag;
}
}
public void setTwitterHashtag(String twitterHashtag) {
_twitterHashtag = twitterHashtag;
}
public String getTwitterDataWidgetId() {
if (_twitterDataWidgetId == null) {
return StringPool.BLANK;
} else {
return _twitterDataWidgetId;
}
}
public void setTwitterDataWidgetId(String twitterDataWidgetId) {
_twitterDataWidgetId = twitterDataWidgetId;
}
@Override
public ExpandoBridge getExpandoBridge() {
return ExpandoBridgeFactoryUtil.getExpandoBridge(0,
ChatRoomTwitter.class.getName(), getPrimaryKey());
}
@Override
public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
ExpandoBridge expandoBridge = getExpandoBridge();
expandoBridge.setAttributes(serviceContext);
}
@Override
public ChatRoomTwitter toEscapedModel() {
if (_escapedModelProxy == null) {
_escapedModelProxy = (ChatRoomTwitter) ProxyUtil.newProxyInstance(_classLoader,
_escapedModelProxyInterfaces,
new AutoEscapeBeanHandler(this));
}
return _escapedModelProxy;
}
@Override
public Object clone() {
ChatRoomTwitterImpl chatRoomTwitterImpl = new ChatRoomTwitterImpl();
chatRoomTwitterImpl.setTwitterId(getTwitterId());
chatRoomTwitterImpl.setTwitterTitle(getTwitterTitle());
chatRoomTwitterImpl.setTwitterDescription(getTwitterDescription());
chatRoomTwitterImpl.setTwitterEnabled(getTwitterEnabled());
chatRoomTwitterImpl.setTwitterHashtag(getTwitterHashtag());
chatRoomTwitterImpl.setTwitterDataWidgetId(getTwitterDataWidgetId());
chatRoomTwitterImpl.resetOriginalValues();
return chatRoomTwitterImpl;
}
public int compareTo(ChatRoomTwitter chatRoomTwitter) {
long primaryKey = chatRoomTwitter.getPrimaryKey();
if (getPrimaryKey() < primaryKey) {
return -1;
} else if (getPrimaryKey() > primaryKey) {
return 1;
} else {
return 0;
}
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
ChatRoomTwitter chatRoomTwitter = null;
try {
chatRoomTwitter = (ChatRoomTwitter) obj;
} catch (ClassCastException cce) {
return false;
}
long primaryKey = chatRoomTwitter.getPrimaryKey();
if (getPrimaryKey() == primaryKey) {
return true;
} else {
return false;
}
}
@Override
public int hashCode() {
return (int) getPrimaryKey();
}
@Override
public void resetOriginalValues() {
}
@Override
public CacheModel<ChatRoomTwitter> toCacheModel() {
ChatRoomTwitterCacheModel chatRoomTwitterCacheModel = new ChatRoomTwitterCacheModel();
chatRoomTwitterCacheModel.twitterId = getTwitterId();
chatRoomTwitterCacheModel.twitterTitle = getTwitterTitle();
String twitterTitle = chatRoomTwitterCacheModel.twitterTitle;
if ((twitterTitle != null) && (twitterTitle.length() == 0)) {
chatRoomTwitterCacheModel.twitterTitle = null;
}
chatRoomTwitterCacheModel.twitterDescription = getTwitterDescription();
String twitterDescription = chatRoomTwitterCacheModel.twitterDescription;
if ((twitterDescription != null) && (twitterDescription.length() == 0)) {
chatRoomTwitterCacheModel.twitterDescription = null;
}
chatRoomTwitterCacheModel.twitterEnabled = getTwitterEnabled();
chatRoomTwitterCacheModel.twitterHashtag = getTwitterHashtag();
String twitterHashtag = chatRoomTwitterCacheModel.twitterHashtag;
if ((twitterHashtag != null) && (twitterHashtag.length() == 0)) {
chatRoomTwitterCacheModel.twitterHashtag = null;
}
chatRoomTwitterCacheModel.twitterDataWidgetId = getTwitterDataWidgetId();
String twitterDataWidgetId = chatRoomTwitterCacheModel.twitterDataWidgetId;
if ((twitterDataWidgetId != null) &&
(twitterDataWidgetId.length() == 0)) {
chatRoomTwitterCacheModel.twitterDataWidgetId = null;
}
return chatRoomTwitterCacheModel;
}
@Override
public String toString() {
StringBundler sb = new StringBundler(13);
sb.append("{twitterId=");
sb.append(getTwitterId());
sb.append(", twitterTitle=");
sb.append(getTwitterTitle());
sb.append(", twitterDescription=");
sb.append(getTwitterDescription());
sb.append(", twitterEnabled=");
sb.append(getTwitterEnabled());
sb.append(", twitterHashtag=");
sb.append(getTwitterHashtag());
sb.append(", twitterDataWidgetId=");
sb.append(getTwitterDataWidgetId());
sb.append("}");
return sb.toString();
}
public String toXmlString() {
StringBundler sb = new StringBundler(22);
sb.append("<model><model-name>");
sb.append(
"br.gov.camara.edemocracia.portlets.chat.model.ChatRoomTwitter");
sb.append("</model-name>");
sb.append(
"<column><column-name>twitterId</column-name><column-value><![CDATA[");
sb.append(getTwitterId());
sb.append("]]></column-value></column>");
sb.append(
"<column><column-name>twitterTitle</column-name><column-value><![CDATA[");
sb.append(getTwitterTitle());
sb.append("]]></column-value></column>");
sb.append(
"<column><column-name>twitterDescription</column-name><column-value><![CDATA[");
sb.append(getTwitterDescription());
sb.append("]]></column-value></column>");
sb.append(
"<column><column-name>twitterEnabled</column-name><column-value><![CDATA[");
sb.append(getTwitterEnabled());
sb.append("]]></column-value></column>");
sb.append(
"<column><column-name>twitterHashtag</column-name><column-value><![CDATA[");
sb.append(getTwitterHashtag());
sb.append("]]></column-value></column>");
sb.append(
"<column><column-name>twitterDataWidgetId</column-name><column-value><![CDATA[");
sb.append(getTwitterDataWidgetId());
sb.append("]]></column-value></column>");
sb.append("</model>");
return sb.toString();
}
}