/**
* Copyright (c) 2000-2012 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.warrantchange.model.impl;
import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.json.JSON;
import com.liferay.portal.kernel.util.DateUtil;
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.portal.util.PortalUtil;
import com.liferay.portlet.expando.model.ExpandoBridge;
import com.liferay.portlet.expando.util.ExpandoBridgeFactoryUtil;
import com.warrantchange.model.WarrantUserEmailLog;
import com.warrantchange.model.WarrantUserEmailLogModel;
import com.warrantchange.model.WarrantUserEmailLogSoap;
import java.io.Serializable;
import java.sql.Types;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
/**
* The base model implementation for the WarrantUserEmailLog service. Represents a row in the "warrantUserEmailLog" database table, with each column mapped to a property of this class.
*
* <p>
* This implementation and its corresponding interface {@link com.warrantchange.model.WarrantUserEmailLogModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link WarrantUserEmailLogImpl}.
* </p>
*
* @author davidk
* @see WarrantUserEmailLogImpl
* @see com.warrantchange.model.WarrantUserEmailLog
* @see com.warrantchange.model.WarrantUserEmailLogModel
* @generated
*/
@JSON(strict = true)
public class WarrantUserEmailLogModelImpl extends BaseModelImpl<WarrantUserEmailLog>
implements WarrantUserEmailLogModel {
/*
* NOTE FOR DEVELOPERS:
*
* Never modify or reference this class directly. All methods that expect a WarrantUserEmailLog model instance should use the {@link com.warrantchange.model.WarrantUserEmailLog} interface instead.
*/
public static final String TABLE_NAME = "warrantUserEmailLog";
public static final Object[][] TABLE_COLUMNS = {
{ "id_", Types.BIGINT },
{ "subject", Types.VARCHAR },
{ "bodyContent", Types.VARCHAR },
{ "userId", Types.BIGINT },
{ "createDate", Types.TIMESTAMP },
{ "modifiedDate", Types.TIMESTAMP }
};
public static final String TABLE_SQL_CREATE = "create table warrantUserEmailLog (id_ LONG not null primary key,subject VARCHAR(75) null,bodyContent VARCHAR(75) null,userId LONG,createDate DATE null,modifiedDate DATE null)";
public static final String TABLE_SQL_DROP = "drop table warrantUserEmailLog";
public static final String ORDER_BY_JPQL = " ORDER BY warrantUserEmailLog.createDate DESC";
public static final String ORDER_BY_SQL = " ORDER BY warrantUserEmailLog.createDate DESC";
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.com.warrantchange.model.WarrantUserEmailLog"),
true);
public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
"value.object.finder.cache.enabled.com.warrantchange.model.WarrantUserEmailLog"),
true);
public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
"value.object.column.bitmask.enabled.com.warrantchange.model.WarrantUserEmailLog"),
true);
public static long USERID_COLUMN_BITMASK = 1L;
/**
* 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 WarrantUserEmailLog toModel(WarrantUserEmailLogSoap soapModel) {
WarrantUserEmailLog model = new WarrantUserEmailLogImpl();
model.setId(soapModel.getId());
model.setSubject(soapModel.getSubject());
model.setBodyContent(soapModel.getBodyContent());
model.setUserId(soapModel.getUserId());
model.setCreateDate(soapModel.getCreateDate());
model.setModifiedDate(soapModel.getModifiedDate());
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<WarrantUserEmailLog> toModels(
WarrantUserEmailLogSoap[] soapModels) {
List<WarrantUserEmailLog> models = new ArrayList<WarrantUserEmailLog>(soapModels.length);
for (WarrantUserEmailLogSoap soapModel : soapModels) {
models.add(toModel(soapModel));
}
return models;
}
public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get(
"lock.expiration.time.com.warrantchange.model.WarrantUserEmailLog"));
public WarrantUserEmailLogModelImpl() {
}
public long getPrimaryKey() {
return _id;
}
public void setPrimaryKey(long primaryKey) {
setId(primaryKey);
}
public Serializable getPrimaryKeyObj() {
return new Long(_id);
}
public void setPrimaryKeyObj(Serializable primaryKeyObj) {
setPrimaryKey(((Long)primaryKeyObj).longValue());
}
public Class<?> getModelClass() {
return WarrantUserEmailLog.class;
}
public String getModelClassName() {
return WarrantUserEmailLog.class.getName();
}
@JSON
public long getId() {
return _id;
}
public void setId(long id) {
_id = id;
}
@JSON
public String getSubject() {
if (_subject == null) {
return StringPool.BLANK;
}
else {
return _subject;
}
}
public void setSubject(String subject) {
_subject = subject;
}
@JSON
public String getBodyContent() {
if (_bodyContent == null) {
return StringPool.BLANK;
}
else {
return _bodyContent;
}
}
public void setBodyContent(String bodyContent) {
_bodyContent = bodyContent;
}
@JSON
public long getUserId() {
return _userId;
}
public void setUserId(long userId) {
_columnBitmask |= USERID_COLUMN_BITMASK;
if (!_setOriginalUserId) {
_setOriginalUserId = true;
_originalUserId = _userId;
}
_userId = userId;
}
public String getUserUuid() throws SystemException {
return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
}
public void setUserUuid(String userUuid) {
_userUuid = userUuid;
}
public long getOriginalUserId() {
return _originalUserId;
}
@JSON
public Date getCreateDate() {
return _createDate;
}
public void setCreateDate(Date createDate) {
_columnBitmask = -1L;
_createDate = createDate;
}
@JSON
public Date getModifiedDate() {
return _modifiedDate;
}
public void setModifiedDate(Date modifiedDate) {
_modifiedDate = modifiedDate;
}
public long getColumnBitmask() {
return _columnBitmask;
}
@Override
public WarrantUserEmailLog toEscapedModel() {
if (_escapedModelProxy == null) {
_escapedModelProxy = (WarrantUserEmailLog)ProxyUtil.newProxyInstance(_classLoader,
_escapedModelProxyInterfaces,
new AutoEscapeBeanHandler(this));
}
return _escapedModelProxy;
}
@Override
public ExpandoBridge getExpandoBridge() {
if (_expandoBridge == null) {
_expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(0,
WarrantUserEmailLog.class.getName(), getPrimaryKey());
}
return _expandoBridge;
}
@Override
public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
getExpandoBridge().setAttributes(serviceContext);
}
@Override
public Object clone() {
WarrantUserEmailLogImpl warrantUserEmailLogImpl = new WarrantUserEmailLogImpl();
warrantUserEmailLogImpl.setId(getId());
warrantUserEmailLogImpl.setSubject(getSubject());
warrantUserEmailLogImpl.setBodyContent(getBodyContent());
warrantUserEmailLogImpl.setUserId(getUserId());
warrantUserEmailLogImpl.setCreateDate(getCreateDate());
warrantUserEmailLogImpl.setModifiedDate(getModifiedDate());
warrantUserEmailLogImpl.resetOriginalValues();
return warrantUserEmailLogImpl;
}
public int compareTo(WarrantUserEmailLog warrantUserEmailLog) {
int value = 0;
value = DateUtil.compareTo(getCreateDate(),
warrantUserEmailLog.getCreateDate());
value = value * -1;
if (value != 0) {
return value;
}
return 0;
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
WarrantUserEmailLog warrantUserEmailLog = null;
try {
warrantUserEmailLog = (WarrantUserEmailLog)obj;
}
catch (ClassCastException cce) {
return false;
}
long primaryKey = warrantUserEmailLog.getPrimaryKey();
if (getPrimaryKey() == primaryKey) {
return true;
}
else {
return false;
}
}
@Override
public int hashCode() {
return (int)getPrimaryKey();
}
@Override
public void resetOriginalValues() {
WarrantUserEmailLogModelImpl warrantUserEmailLogModelImpl = this;
warrantUserEmailLogModelImpl._originalUserId = warrantUserEmailLogModelImpl._userId;
warrantUserEmailLogModelImpl._setOriginalUserId = false;
warrantUserEmailLogModelImpl._columnBitmask = 0;
}
@Override
public CacheModel<WarrantUserEmailLog> toCacheModel() {
WarrantUserEmailLogCacheModel warrantUserEmailLogCacheModel = new WarrantUserEmailLogCacheModel();
warrantUserEmailLogCacheModel.id = getId();
warrantUserEmailLogCacheModel.subject = getSubject();
String subject = warrantUserEmailLogCacheModel.subject;
if ((subject != null) && (subject.length() == 0)) {
warrantUserEmailLogCacheModel.subject = null;
}
warrantUserEmailLogCacheModel.bodyContent = getBodyContent();
String bodyContent = warrantUserEmailLogCacheModel.bodyContent;
if ((bodyContent != null) && (bodyContent.length() == 0)) {
warrantUserEmailLogCacheModel.bodyContent = null;
}
warrantUserEmailLogCacheModel.userId = getUserId();
Date createDate = getCreateDate();
if (createDate != null) {
warrantUserEmailLogCacheModel.createDate = createDate.getTime();
}
else {
warrantUserEmailLogCacheModel.createDate = Long.MIN_VALUE;
}
Date modifiedDate = getModifiedDate();
if (modifiedDate != null) {
warrantUserEmailLogCacheModel.modifiedDate = modifiedDate.getTime();
}
else {
warrantUserEmailLogCacheModel.modifiedDate = Long.MIN_VALUE;
}
return warrantUserEmailLogCacheModel;
}
@Override
public String toString() {
StringBundler sb = new StringBundler(13);
sb.append("{id=");
sb.append(getId());
sb.append(", subject=");
sb.append(getSubject());
sb.append(", bodyContent=");
sb.append(getBodyContent());
sb.append(", userId=");
sb.append(getUserId());
sb.append(", createDate=");
sb.append(getCreateDate());
sb.append(", modifiedDate=");
sb.append(getModifiedDate());
sb.append("}");
return sb.toString();
}
public String toXmlString() {
StringBundler sb = new StringBundler(22);
sb.append("<model><model-name>");
sb.append("com.warrantchange.model.WarrantUserEmailLog");
sb.append("</model-name>");
sb.append(
"<column><column-name>id</column-name><column-value><![CDATA[");
sb.append(getId());
sb.append("]]></column-value></column>");
sb.append(
"<column><column-name>subject</column-name><column-value><![CDATA[");
sb.append(getSubject());
sb.append("]]></column-value></column>");
sb.append(
"<column><column-name>bodyContent</column-name><column-value><![CDATA[");
sb.append(getBodyContent());
sb.append("]]></column-value></column>");
sb.append(
"<column><column-name>userId</column-name><column-value><![CDATA[");
sb.append(getUserId());
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("</model>");
return sb.toString();
}
private static ClassLoader _classLoader = WarrantUserEmailLog.class.getClassLoader();
private static Class<?>[] _escapedModelProxyInterfaces = new Class[] {
WarrantUserEmailLog.class
};
private long _id;
private String _subject;
private String _bodyContent;
private long _userId;
private String _userUuid;
private long _originalUserId;
private boolean _setOriginalUserId;
private Date _createDate;
private Date _modifiedDate;
private transient ExpandoBridge _expandoBridge;
private long _columnBitmask;
private WarrantUserEmailLog _escapedModelProxy;
}