com.liferay.portlet.trash.model.impl.TrashVersionModelImpl Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of portal-impl Show documentation
Show all versions of portal-impl Show documentation
Contains implementation for the portal services.
/**
* Copyright (c) 2000-2013 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.portlet.trash.model.impl;
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.kernel.util.Validator;
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.liferay.portlet.trash.model.TrashVersion;
import com.liferay.portlet.trash.model.TrashVersionModel;
import java.io.Serializable;
import java.sql.Types;
import java.util.HashMap;
import java.util.Map;
/**
* The base model implementation for the TrashVersion service. Represents a row in the "TrashVersion" database table, with each column mapped to a property of this class.
*
*
* This implementation and its corresponding interface {@link com.liferay.portlet.trash.model.TrashVersionModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link TrashVersionImpl}.
*
*
* @author Brian Wing Shun Chan
* @see TrashVersionImpl
* @see com.liferay.portlet.trash.model.TrashVersion
* @see com.liferay.portlet.trash.model.TrashVersionModel
* @generated
*/
public class TrashVersionModelImpl extends BaseModelImpl
implements TrashVersionModel {
/*
* NOTE FOR DEVELOPERS:
*
* Never modify or reference this class directly. All methods that expect a trash version model instance should use the {@link com.liferay.portlet.trash.model.TrashVersion} interface instead.
*/
public static final String TABLE_NAME = "TrashVersion";
public static final Object[][] TABLE_COLUMNS = {
{ "versionId", Types.BIGINT },
{ "entryId", Types.BIGINT },
{ "classNameId", Types.BIGINT },
{ "classPK", Types.BIGINT },
{ "typeSettings", Types.CLOB },
{ "status", Types.INTEGER }
};
public static final String TABLE_SQL_CREATE = "create table TrashVersion (versionId LONG not null primary key,entryId LONG,classNameId LONG,classPK LONG,typeSettings TEXT null,status INTEGER)";
public static final String TABLE_SQL_DROP = "drop table TrashVersion";
public static final String ORDER_BY_JPQL = " ORDER BY trashVersion.versionId ASC";
public static final String ORDER_BY_SQL = " ORDER BY TrashVersion.versionId 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.portal.util.PropsUtil.get(
"value.object.entity.cache.enabled.com.liferay.portlet.trash.model.TrashVersion"),
true);
public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
"value.object.finder.cache.enabled.com.liferay.portlet.trash.model.TrashVersion"),
true);
public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
"value.object.column.bitmask.enabled.com.liferay.portlet.trash.model.TrashVersion"),
true);
public static long CLASSNAMEID_COLUMN_BITMASK = 1L;
public static long CLASSPK_COLUMN_BITMASK = 2L;
public static long ENTRYID_COLUMN_BITMASK = 4L;
public static long VERSIONID_COLUMN_BITMASK = 8L;
public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
"lock.expiration.time.com.liferay.portlet.trash.model.TrashVersion"));
public TrashVersionModelImpl() {
}
@Override
public long getPrimaryKey() {
return _versionId;
}
@Override
public void setPrimaryKey(long primaryKey) {
setVersionId(primaryKey);
}
@Override
public Serializable getPrimaryKeyObj() {
return _versionId;
}
@Override
public void setPrimaryKeyObj(Serializable primaryKeyObj) {
setPrimaryKey(((Long)primaryKeyObj).longValue());
}
@Override
public Class getModelClass() {
return TrashVersion.class;
}
@Override
public String getModelClassName() {
return TrashVersion.class.getName();
}
@Override
public Map getModelAttributes() {
Map attributes = new HashMap();
attributes.put("versionId", getVersionId());
attributes.put("entryId", getEntryId());
attributes.put("classNameId", getClassNameId());
attributes.put("classPK", getClassPK());
attributes.put("typeSettings", getTypeSettings());
attributes.put("status", getStatus());
return attributes;
}
@Override
public void setModelAttributes(Map attributes) {
Long versionId = (Long)attributes.get("versionId");
if (versionId != null) {
setVersionId(versionId);
}
Long entryId = (Long)attributes.get("entryId");
if (entryId != null) {
setEntryId(entryId);
}
Long classNameId = (Long)attributes.get("classNameId");
if (classNameId != null) {
setClassNameId(classNameId);
}
Long classPK = (Long)attributes.get("classPK");
if (classPK != null) {
setClassPK(classPK);
}
String typeSettings = (String)attributes.get("typeSettings");
if (typeSettings != null) {
setTypeSettings(typeSettings);
}
Integer status = (Integer)attributes.get("status");
if (status != null) {
setStatus(status);
}
}
@Override
public long getVersionId() {
return _versionId;
}
@Override
public void setVersionId(long versionId) {
_versionId = versionId;
}
@Override
public long getEntryId() {
return _entryId;
}
@Override
public void setEntryId(long entryId) {
_columnBitmask |= ENTRYID_COLUMN_BITMASK;
if (!_setOriginalEntryId) {
_setOriginalEntryId = true;
_originalEntryId = _entryId;
}
_entryId = entryId;
}
public long getOriginalEntryId() {
return _originalEntryId;
}
@Override
public String getClassName() {
if (getClassNameId() <= 0) {
return StringPool.BLANK;
}
return PortalUtil.getClassName(getClassNameId());
}
@Override
public void setClassName(String className) {
long classNameId = 0;
if (Validator.isNotNull(className)) {
classNameId = PortalUtil.getClassNameId(className);
}
setClassNameId(classNameId);
}
@Override
public long getClassNameId() {
return _classNameId;
}
@Override
public void setClassNameId(long classNameId) {
_columnBitmask |= CLASSNAMEID_COLUMN_BITMASK;
if (!_setOriginalClassNameId) {
_setOriginalClassNameId = true;
_originalClassNameId = _classNameId;
}
_classNameId = classNameId;
}
public long getOriginalClassNameId() {
return _originalClassNameId;
}
@Override
public long getClassPK() {
return _classPK;
}
@Override
public void setClassPK(long classPK) {
_columnBitmask |= CLASSPK_COLUMN_BITMASK;
if (!_setOriginalClassPK) {
_setOriginalClassPK = true;
_originalClassPK = _classPK;
}
_classPK = classPK;
}
public long getOriginalClassPK() {
return _originalClassPK;
}
@Override
public String getTypeSettings() {
if (_typeSettings == null) {
return StringPool.BLANK;
}
else {
return _typeSettings;
}
}
@Override
public void setTypeSettings(String typeSettings) {
_typeSettings = typeSettings;
}
@Override
public int getStatus() {
return _status;
}
@Override
public void setStatus(int status) {
_status = status;
}
public long getColumnBitmask() {
return _columnBitmask;
}
@Override
public ExpandoBridge getExpandoBridge() {
return ExpandoBridgeFactoryUtil.getExpandoBridge(0,
TrashVersion.class.getName(), getPrimaryKey());
}
@Override
public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
ExpandoBridge expandoBridge = getExpandoBridge();
expandoBridge.setAttributes(serviceContext);
}
@Override
public TrashVersion toEscapedModel() {
if (_escapedModel == null) {
_escapedModel = (TrashVersion)ProxyUtil.newProxyInstance(_classLoader,
_escapedModelInterfaces, new AutoEscapeBeanHandler(this));
}
return _escapedModel;
}
@Override
public Object clone() {
TrashVersionImpl trashVersionImpl = new TrashVersionImpl();
trashVersionImpl.setVersionId(getVersionId());
trashVersionImpl.setEntryId(getEntryId());
trashVersionImpl.setClassNameId(getClassNameId());
trashVersionImpl.setClassPK(getClassPK());
trashVersionImpl.setTypeSettings(getTypeSettings());
trashVersionImpl.setStatus(getStatus());
trashVersionImpl.resetOriginalValues();
return trashVersionImpl;
}
@Override
public int compareTo(TrashVersion trashVersion) {
long primaryKey = trashVersion.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 TrashVersion)) {
return false;
}
TrashVersion trashVersion = (TrashVersion)obj;
long primaryKey = trashVersion.getPrimaryKey();
if (getPrimaryKey() == primaryKey) {
return true;
}
else {
return false;
}
}
@Override
public int hashCode() {
return (int)getPrimaryKey();
}
@Override
public void resetOriginalValues() {
TrashVersionModelImpl trashVersionModelImpl = this;
trashVersionModelImpl._originalEntryId = trashVersionModelImpl._entryId;
trashVersionModelImpl._setOriginalEntryId = false;
trashVersionModelImpl._originalClassNameId = trashVersionModelImpl._classNameId;
trashVersionModelImpl._setOriginalClassNameId = false;
trashVersionModelImpl._originalClassPK = trashVersionModelImpl._classPK;
trashVersionModelImpl._setOriginalClassPK = false;
trashVersionModelImpl._columnBitmask = 0;
}
@Override
public CacheModel toCacheModel() {
TrashVersionCacheModel trashVersionCacheModel = new TrashVersionCacheModel();
trashVersionCacheModel.versionId = getVersionId();
trashVersionCacheModel.entryId = getEntryId();
trashVersionCacheModel.classNameId = getClassNameId();
trashVersionCacheModel.classPK = getClassPK();
trashVersionCacheModel.typeSettings = getTypeSettings();
String typeSettings = trashVersionCacheModel.typeSettings;
if ((typeSettings != null) && (typeSettings.length() == 0)) {
trashVersionCacheModel.typeSettings = null;
}
trashVersionCacheModel.status = getStatus();
return trashVersionCacheModel;
}
@Override
public String toString() {
StringBundler sb = new StringBundler(13);
sb.append("{versionId=");
sb.append(getVersionId());
sb.append(", entryId=");
sb.append(getEntryId());
sb.append(", classNameId=");
sb.append(getClassNameId());
sb.append(", classPK=");
sb.append(getClassPK());
sb.append(", typeSettings=");
sb.append(getTypeSettings());
sb.append(", status=");
sb.append(getStatus());
sb.append("}");
return sb.toString();
}
@Override
public String toXmlString() {
StringBundler sb = new StringBundler(22);
sb.append("");
sb.append("com.liferay.portlet.trash.model.TrashVersion");
sb.append(" ");
sb.append(
"versionId ");
sb.append(
"entryId ");
sb.append(
"classNameId ");
sb.append(
"classPK ");
sb.append(
"typeSettings ");
sb.append(
"status ");
sb.append(" ");
return sb.toString();
}
private static ClassLoader _classLoader = TrashVersion.class.getClassLoader();
private static Class[] _escapedModelInterfaces = new Class[] {
TrashVersion.class
};
private long _versionId;
private long _entryId;
private long _originalEntryId;
private boolean _setOriginalEntryId;
private long _classNameId;
private long _originalClassNameId;
private boolean _setOriginalClassNameId;
private long _classPK;
private long _originalClassPK;
private boolean _setOriginalClassPK;
private String _typeSettings;
private int _status;
private long _columnBitmask;
private TrashVersion _escapedModel;
}