/**
* 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.Warrant;
import com.warrantchange.model.WarrantModel;
import com.warrantchange.model.WarrantSoap;
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 Warrant service. Represents a row in the "warrant" database table, with each column mapped to a property of this class.
*
* <p>
* This implementation and its corresponding interface {@link com.warrantchange.model.WarrantModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link WarrantImpl}.
* </p>
*
* @author davidk
* @see WarrantImpl
* @see com.warrantchange.model.Warrant
* @see com.warrantchange.model.WarrantModel
* @generated
*/
@JSON(strict = true)
public class WarrantModelImpl extends BaseModelImpl<Warrant>
implements WarrantModel {
/*
* NOTE FOR DEVELOPERS:
*
* Never modify or reference this class directly. All methods that expect a Warrant model instance should use the {@link com.warrantchange.model.Warrant} interface instead.
*/
public static final String TABLE_NAME = "warrant";
public static final Object[][] TABLE_COLUMNS = {
{ "id_", Types.BIGINT },
{ "userId", Types.BIGINT },
{ "summary", Types.VARCHAR },
{ "quantity", Types.INTEGER },
{ "price", Types.DOUBLE },
{ "status", Types.VARCHAR },
{ "createDate", Types.TIMESTAMP },
{ "modifiedDate", Types.TIMESTAMP },
{ "expirationWarningSent", Types.BOOLEAN }
};
public static final String TABLE_SQL_CREATE = "create table warrant (id_ LONG not null primary key,userId LONG,summary VARCHAR(75) null,quantity INTEGER,price DOUBLE,status VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,expirationWarningSent BOOLEAN)";
public static final String TABLE_SQL_DROP = "drop table warrant";
public static final String ORDER_BY_JPQL = " ORDER BY warrant.createDate DESC";
public static final String ORDER_BY_SQL = " ORDER BY warrant.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.Warrant"),
true);
public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
"value.object.finder.cache.enabled.com.warrantchange.model.Warrant"),
true);
public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
"value.object.column.bitmask.enabled.com.warrantchange.model.Warrant"),
true);
public static long CREATEDATE_COLUMN_BITMASK = 1L;
public static long EXPIRATIONWARNINGSENT_COLUMN_BITMASK = 2L;
public static long STATUS_COLUMN_BITMASK = 4L;
public static long USERID_COLUMN_BITMASK = 8L;
/**
* 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 Warrant toModel(WarrantSoap soapModel) {
Warrant model = new WarrantImpl();
model.setId(soapModel.getId());
model.setUserId(soapModel.getUserId());
model.setSummary(soapModel.getSummary());
model.setQuantity(soapModel.getQuantity());
model.setPrice(soapModel.getPrice());
model.setStatus(soapModel.getStatus());
model.setCreateDate(soapModel.getCreateDate());
model.setModifiedDate(soapModel.getModifiedDate());
model.setExpirationWarningSent(soapModel.getExpirationWarningSent());
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<Warrant> toModels(WarrantSoap[] soapModels) {
List<Warrant> models = new ArrayList<Warrant>(soapModels.length);
for (WarrantSoap 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.Warrant"));
public WarrantModelImpl() {
}
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 Warrant.class;
}
public String getModelClassName() {
return Warrant.class.getName();
}
@JSON
public long getId() {
return _id;
}
public void setId(long id) {
_id = id;
}
@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 String getSummary() {
if (_summary == null) {
return StringPool.BLANK;
}
else {
return _summary;
}
}
public void setSummary(String summary) {
_summary = summary;
}
@JSON
public int getQuantity() {
return _quantity;
}
public void setQuantity(int quantity) {
_quantity = quantity;
}
@JSON
public double getPrice() {
return _price;
}
public void setPrice(double price) {
_price = price;
}
@JSON
public String getStatus() {
if (_status == null) {
return StringPool.BLANK;
}
else {
return _status;
}
}
public void setStatus(String status) {
_columnBitmask |= STATUS_COLUMN_BITMASK;
if (_originalStatus == null) {
_originalStatus = _status;
}
_status = status;
}
public String getOriginalStatus() {
return GetterUtil.getString(_originalStatus);
}
@JSON
public Date getCreateDate() {
return _createDate;
}
public void setCreateDate(Date createDate) {
_columnBitmask = -1L;
if (_originalCreateDate == null) {
_originalCreateDate = _createDate;
}
_createDate = createDate;
}
public Date getOriginalCreateDate() {
return _originalCreateDate;
}
@JSON
public Date getModifiedDate() {
return _modifiedDate;
}
public void setModifiedDate(Date modifiedDate) {
_modifiedDate = modifiedDate;
}
@JSON
public boolean getExpirationWarningSent() {
return _expirationWarningSent;
}
public boolean isExpirationWarningSent() {
return _expirationWarningSent;
}
public void setExpirationWarningSent(boolean expirationWarningSent) {
_columnBitmask |= EXPIRATIONWARNINGSENT_COLUMN_BITMASK;
if (!_setOriginalExpirationWarningSent) {
_setOriginalExpirationWarningSent = true;
_originalExpirationWarningSent = _expirationWarningSent;
}
_expirationWarningSent = expirationWarningSent;
}
public boolean getOriginalExpirationWarningSent() {
return _originalExpirationWarningSent;
}
public long getColumnBitmask() {
return _columnBitmask;
}
@Override
public Warrant toEscapedModel() {
if (_escapedModelProxy == null) {
_escapedModelProxy = (Warrant)ProxyUtil.newProxyInstance(_classLoader,
_escapedModelProxyInterfaces,
new AutoEscapeBeanHandler(this));
}
return _escapedModelProxy;
}
@Override
public ExpandoBridge getExpandoBridge() {
if (_expandoBridge == null) {
_expandoBridge = ExpandoBridgeFactoryUtil.getExpandoBridge(0,
Warrant.class.getName(), getPrimaryKey());
}
return _expandoBridge;
}
@Override
public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
getExpandoBridge().setAttributes(serviceContext);
}
@Override
public Object clone() {
WarrantImpl warrantImpl = new WarrantImpl();
warrantImpl.setId(getId());
warrantImpl.setUserId(getUserId());
warrantImpl.setSummary(getSummary());
warrantImpl.setQuantity(getQuantity());
warrantImpl.setPrice(getPrice());
warrantImpl.setStatus(getStatus());
warrantImpl.setCreateDate(getCreateDate());
warrantImpl.setModifiedDate(getModifiedDate());
warrantImpl.setExpirationWarningSent(getExpirationWarningSent());
warrantImpl.resetOriginalValues();
return warrantImpl;
}
public int compareTo(Warrant warrant) {
int value = 0;
value = DateUtil.compareTo(getCreateDate(), warrant.getCreateDate());
value = value * -1;
if (value != 0) {
return value;
}
return 0;
}
@Override
public boolean equals(Object obj) {
if (obj == null) {
return false;
}
Warrant warrant = null;
try {
warrant = (Warrant)obj;
}
catch (ClassCastException cce) {
return false;
}
long primaryKey = warrant.getPrimaryKey();
if (getPrimaryKey() == primaryKey) {
return true;
}
else {
return false;
}
}
@Override
public int hashCode() {
return (int)getPrimaryKey();
}
@Override
public void resetOriginalValues() {
WarrantModelImpl warrantModelImpl = this;
warrantModelImpl._originalUserId = warrantModelImpl._userId;
warrantModelImpl._setOriginalUserId = false;
warrantModelImpl._originalStatus = warrantModelImpl._status;
warrantModelImpl._originalCreateDate = warrantModelImpl._createDate;
warrantModelImpl._originalExpirationWarningSent = warrantModelImpl._expirationWarningSent;
warrantModelImpl._setOriginalExpirationWarningSent = false;
warrantModelImpl._columnBitmask = 0;
}
@Override
public CacheModel<Warrant> toCacheModel() {
WarrantCacheModel warrantCacheModel = new WarrantCacheModel();
warrantCacheModel.id = getId();
warrantCacheModel.userId = getUserId();
warrantCacheModel.summary = getSummary();
String summary = warrantCacheModel.summary;
if ((summary != null) && (summary.length() == 0)) {
warrantCacheModel.summary = null;
}
warrantCacheModel.quantity = getQuantity();
warrantCacheModel.price = getPrice();
warrantCacheModel.status = getStatus();
String status = warrantCacheModel.status;
if ((status != null) && (status.length() == 0)) {
warrantCacheModel.status = null;
}
Date createDate = getCreateDate();
if (createDate != null) {
warrantCacheModel.createDate = createDate.getTime();
}
else {
warrantCacheModel.createDate = Long.MIN_VALUE;
}
Date modifiedDate = getModifiedDate();
if (modifiedDate != null) {
warrantCacheModel.modifiedDate = modifiedDate.getTime();
}
else {
warrantCacheModel.modifiedDate = Long.MIN_VALUE;
}
warrantCacheModel.expirationWarningSent = getExpirationWarningSent();
return warrantCacheModel;
}
@Override
public String toString() {
StringBundler sb = new StringBundler(19);
sb.append("{id=");
sb.append(getId());
sb.append(", userId=");
sb.append(getUserId());
sb.append(", summary=");
sb.append(getSummary());
sb.append(", quantity=");
sb.append(getQuantity());
sb.append(", price=");
sb.append(getPrice());
sb.append(", status=");
sb.append(getStatus());
sb.append(", createDate=");
sb.append(getCreateDate());
sb.append(", modifiedDate=");
sb.append(getModifiedDate());
sb.append(", expirationWarningSent=");
sb.append(getExpirationWarningSent());
sb.append("}");
return sb.toString();
}
public String toXmlString() {
StringBundler sb = new StringBundler(31);
sb.append("<model><model-name>");
sb.append("com.warrantchange.model.Warrant");
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>userId</column-name><column-value><![CDATA[");
sb.append(getUserId());
sb.append("]]></column-value></column>");
sb.append(
"<column><column-name>summary</column-name><column-value><![CDATA[");
sb.append(getSummary());
sb.append("]]></column-value></column>");
sb.append(
"<column><column-name>quantity</column-name><column-value><![CDATA[");
sb.append(getQuantity());
sb.append("]]></column-value></column>");
sb.append(
"<column><column-name>price</column-name><column-value><![CDATA[");
sb.append(getPrice());
sb.append("]]></column-value></column>");
sb.append(
"<column><column-name>status</column-name><column-value><![CDATA[");
sb.append(getStatus());
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>expirationWarningSent</column-name><column-value><![CDATA[");
sb.append(getExpirationWarningSent());
sb.append("]]></column-value></column>");
sb.append("</model>");
return sb.toString();
}
private static ClassLoader _classLoader = Warrant.class.getClassLoader();
private static Class<?>[] _escapedModelProxyInterfaces = new Class[] {
Warrant.class
};
private long _id;
private long _userId;
private String _userUuid;
private long _originalUserId;
private boolean _setOriginalUserId;
private String _summary;
private int _quantity;
private double _price;
private String _status;
private String _originalStatus;
private Date _createDate;
private Date _originalCreateDate;
private Date _modifiedDate;
private boolean _expirationWarningSent;
private boolean _originalExpirationWarningSent;
private boolean _setOriginalExpirationWarningSent;
private transient ExpandoBridge _expandoBridge;
private long _columnBitmask;
private Warrant _escapedModelProxy;
}