/**
* 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 org.oep.datamgt.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.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 org.oep.datamgt.model.DictAttribute;
import org.oep.datamgt.model.DictAttributeModel;
import org.oep.datamgt.model.DictAttributeSoap;
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 DictAttribute service. Represents a row in the "oep_datamgt_dictattribute" database table, with each column mapped to a property of this class.
*
* <p>
* This implementation and its corresponding interface {@link org.oep.datamgt.model.DictAttributeModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link DictAttributeImpl}.
* </p>
*
* @author NQMINH
* @see DictAttributeImpl
* @see org.oep.datamgt.model.DictAttribute
* @see org.oep.datamgt.model.DictAttributeModel
* @generated
*/
@JSON(strict = true)
public class DictAttributeModelImpl extends BaseModelImpl<DictAttribute>
implements DictAttributeModel {
/*
* NOTE FOR DEVELOPERS:
*
* Never modify or reference this class directly. All methods that expect a dictionary attribute model instance should use the {@link org.oep.datamgt.model.DictAttribute} interface instead.
*/
public static final String TABLE_NAME = "oep_datamgt_dictattribute";
public static final Object[][] TABLE_COLUMNS = {
{ "dictAttributeId", Types.BIGINT },
{ "companyId", Types.BIGINT },
{ "groupId", Types.BIGINT },
{ "userId", Types.BIGINT },
{ "createDate", Types.TIMESTAMP },
{ "modifiedDate", Types.TIMESTAMP },
{ "collectionName", Types.VARCHAR },
{ "name", Types.VARCHAR },
{ "title", Types.VARCHAR },
{ "dataType", Types.VARCHAR }
};
public static final String TABLE_SQL_CREATE = "create table oep_datamgt_dictattribute (dictAttributeId LONG not null primary key,companyId LONG,groupId LONG,userId LONG,createDate DATE null,modifiedDate DATE null,collectionName VARCHAR(75) null,name VARCHAR(75) null,title VARCHAR(75) null,dataType VARCHAR(75) null)";
public static final String TABLE_SQL_DROP = "drop table oep_datamgt_dictattribute";
public static final String ORDER_BY_JPQL = " ORDER BY dictAttribute.dictAttributeId ASC";
public static final String ORDER_BY_SQL = " ORDER BY oep_datamgt_dictattribute.dictAttributeId 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.util.service.ServiceProps.get(
"value.object.entity.cache.enabled.org.oep.datamgt.model.DictAttribute"),
true);
public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
"value.object.finder.cache.enabled.org.oep.datamgt.model.DictAttribute"),
true);
public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get(
"value.object.column.bitmask.enabled.org.oep.datamgt.model.DictAttribute"),
true);
public static long COLLECTIONNAME_COLUMN_BITMASK = 1L;
public static long COMPANYID_COLUMN_BITMASK = 2L;
public static long DATATYPE_COLUMN_BITMASK = 4L;
public static long GROUPID_COLUMN_BITMASK = 8L;
public static long DICTATTRIBUTEID_COLUMN_BITMASK = 16L;
/**
* 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 DictAttribute toModel(DictAttributeSoap soapModel) {
if (soapModel == null) {
return null;
}
DictAttribute model = new DictAttributeImpl();
model.setDictAttributeId(soapModel.getDictAttributeId());
model.setCompanyId(soapModel.getCompanyId());
model.setGroupId(soapModel.getGroupId());
model.setUserId(soapModel.getUserId());
model.setCreateDate(soapModel.getCreateDate());
model.setModifiedDate(soapModel.getModifiedDate());
model.setCollectionName(soapModel.getCollectionName());
model.setName(soapModel.getName());
model.setTitle(soapModel.getTitle());
model.setDataType(soapModel.getDataType());
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<DictAttribute> toModels(DictAttributeSoap[] soapModels) {
if (soapModels == null) {
return null;
}
List<DictAttribute> models = new ArrayList<DictAttribute>(soapModels.length);
for (DictAttributeSoap 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.org.oep.datamgt.model.DictAttribute"));
public DictAttributeModelImpl() {
}
@Override
public long getPrimaryKey() {
return _dictAttributeId;
}
@Override
public void setPrimaryKey(long primaryKey) {
setDictAttributeId(primaryKey);
}
@Override
public Serializable getPrimaryKeyObj() {
return _dictAttributeId;
}
@Override
public void setPrimaryKeyObj(Serializable primaryKeyObj) {
setPrimaryKey(((Long)primaryKeyObj).longValue());
}
@Override
public Class<?> getModelClass() {
return DictAttribute.class;
}
@Override
public String getModelClassName() {
return DictAttribute.class.getName();
}
@Override
public Map<String, Object> getModelAttributes() {
Map<String, Object> attributes = new HashMap<String, Object>();
attributes.put("dictAttributeId", getDictAttributeId());
attributes.put("companyId", getCompanyId());
attributes.put("groupId", getGroupId());
attributes.put("userId", getUserId());
attributes.put("createDate", getCreateDate());
attributes.put("modifiedDate", getModifiedDate());
attributes.put("collectionName", getCollectionName());
attributes.put("name", getName());
attributes.put("title", getTitle());
attributes.put("dataType", getDataType());
return attributes;
}
@Override
public void setModelAttributes(Map<String, Object> attributes) {
Long dictAttributeId = (Long)attributes.get("dictAttributeId");
if (dictAttributeId != null) {
setDictAttributeId(dictAttributeId);
}
Long companyId = (Long)attributes.get("companyId");
if (companyId != null) {
setCompanyId(companyId);
}
Long groupId = (Long)attributes.get("groupId");
if (groupId != null) {
setGroupId(groupId);
}
Long userId = (Long)attributes.get("userId");
if (userId != null) {
setUserId(userId);
}
Date createDate = (Date)attributes.get("createDate");
if (createDate != null) {
setCreateDate(createDate);
}
Date modifiedDate = (Date)attributes.get("modifiedDate");
if (modifiedDate != null) {
setModifiedDate(modifiedDate);
}
String collectionName = (String)attributes.get("collectionName");
if (collectionName != null) {
setCollectionName(collectionName);
}
String name = (String)attributes.get("name");
if (name != null) {
setName(name);
}
String title = (String)attributes.get("title");
if (title != null) {
setTitle(title);
}
String dataType = (String)attributes.get("dataType");
if (dataType != null) {
setDataType(dataType);
}
}
@JSON
@Override
public long getDictAttributeId() {
return _dictAttributeId;
}
@Override
public void setDictAttributeId(long dictAttributeId) {
_dictAttributeId = dictAttributeId;
}
@JSON
@Override
public long getCompanyId() {
return _companyId;
}
@Override
public void setCompanyId(long companyId) {
_columnBitmask |= COMPANYID_COLUMN_BITMASK;
if (!_setOriginalCompanyId) {
_setOriginalCompanyId = true;
_originalCompanyId = _companyId;
}
_companyId = companyId;
}
public long getOriginalCompanyId() {
return _originalCompanyId;
}
@JSON
@Override
public long getGroupId() {
return _groupId;
}
@Override
public void setGroupId(long groupId) {
_columnBitmask |= GROUPID_COLUMN_BITMASK;
if (!_setOriginalGroupId) {
_setOriginalGroupId = true;
_originalGroupId = _groupId;
}
_groupId = groupId;
}
public long getOriginalGroupId() {
return _originalGroupId;
}
@JSON
@Override
public long getUserId() {
return _userId;
}
@Override
public void setUserId(long userId) {
_userId = userId;
}
@Override
public String getUserUuid() throws SystemException {
return PortalUtil.getUserValue(getUserId(), "uuid", _userUuid);
}
@Override
public void setUserUuid(String userUuid) {
_userUuid = userUuid;
}
@JSON
@Override
public Date getCreateDate() {
return _createDate;
}
@Override
public void setCreateDate(Date createDate) {
_createDate = createDate;
}
@JSON
@Override
public Date getModifiedDate() {
return _modifiedDate;
}
@Override
public void setModifiedDate(Date modifiedDate) {
_modifiedDate = modifiedDate;
}
@JSON
@Override
public String getCollectionName() {
if (_collectionName == null) {
return StringPool.BLANK;
}
else {
return _collectionName;
}
}
@Override
public void setCollectionName(String collectionName) {
_columnBitmask |= COLLECTIONNAME_COLUMN_BITMASK;
if (_originalCollectionName == null) {
_originalCollectionName = _collectionName;
}
_collectionName = collectionName;
}
public String getOriginalCollectionName() {
return GetterUtil.getString(_originalCollectionName);
}
@JSON
@Override
public String getName() {
if (_name == null) {
return StringPool.BLANK;
}
else {
return _name;
}
}
@Override
public void setName(String name) {
_name = name;
}
@JSON
@Override
public String getTitle() {
if (_title == null) {
return StringPool.BLANK;
}
else {
return _title;
}
}
@Override
public void setTitle(String title) {
_title = title;
}
@JSON
@Override
public String getDataType() {
if (_dataType == null) {
return StringPool.BLANK;
}
else {
return _dataType;
}
}
@Override
public void setDataType(String dataType) {
_columnBitmask |= DATATYPE_COLUMN_BITMASK;
if (_originalDataType == null) {
_originalDataType = _dataType;
}
_dataType = dataType;
}
public String getOriginalDataType() {
return GetterUtil.getString(_originalDataType);
}
public long getColumnBitmask() {
return _columnBitmask;
}
@Override
public ExpandoBridge getExpandoBridge() {
return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(),
DictAttribute.class.getName(), getPrimaryKey());
}
@Override
public void setExpandoBridgeAttributes(ServiceContext serviceContext) {
ExpandoBridge expandoBridge = getExpandoBridge();
expandoBridge.setAttributes(serviceContext);
}
@Override
public DictAttribute toEscapedModel() {
if (_escapedModel == null) {
_escapedModel = (DictAttribute)ProxyUtil.newProxyInstance(_classLoader,
_escapedModelInterfaces, new AutoEscapeBeanHandler(this));
}
return _escapedModel;
}
@Override
public Object clone() {
DictAttributeImpl dictAttributeImpl = new DictAttributeImpl();
dictAttributeImpl.setDictAttributeId(getDictAttributeId());
dictAttributeImpl.setCompanyId(getCompanyId());
dictAttributeImpl.setGroupId(getGroupId());
dictAttributeImpl.setUserId(getUserId());
dictAttributeImpl.setCreateDate(getCreateDate());
dictAttributeImpl.setModifiedDate(getModifiedDate());
dictAttributeImpl.setCollectionName(getCollectionName());
dictAttributeImpl.setName(getName());
dictAttributeImpl.setTitle(getTitle());
dictAttributeImpl.setDataType(getDataType());
dictAttributeImpl.resetOriginalValues();
return dictAttributeImpl;
}
@Override
public int compareTo(DictAttribute dictAttribute) {
long primaryKey = dictAttribute.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 DictAttribute)) {
return false;
}
DictAttribute dictAttribute = (DictAttribute)obj;
long primaryKey = dictAttribute.getPrimaryKey();
if (getPrimaryKey() == primaryKey) {
return true;
}
else {
return false;
}
}
@Override
public int hashCode() {
return (int)getPrimaryKey();
}
@Override
public void resetOriginalValues() {
DictAttributeModelImpl dictAttributeModelImpl = this;
dictAttributeModelImpl._originalCompanyId = dictAttributeModelImpl._companyId;
dictAttributeModelImpl._setOriginalCompanyId = false;
dictAttributeModelImpl._originalGroupId = dictAttributeModelImpl._groupId;
dictAttributeModelImpl._setOriginalGroupId = false;
dictAttributeModelImpl._originalCollectionName = dictAttributeModelImpl._collectionName;
dictAttributeModelImpl._originalDataType = dictAttributeModelImpl._dataType;
dictAttributeModelImpl._columnBitmask = 0;
}
@Override
public CacheModel<DictAttribute> toCacheModel() {
DictAttributeCacheModel dictAttributeCacheModel = new DictAttributeCacheModel();
dictAttributeCacheModel.dictAttributeId = getDictAttributeId();
dictAttributeCacheModel.companyId = getCompanyId();
dictAttributeCacheModel.groupId = getGroupId();
dictAttributeCacheModel.userId = getUserId();
Date createDate = getCreateDate();
if (createDate != null) {
dictAttributeCacheModel.createDate = createDate.getTime();
}
else {
dictAttributeCacheModel.createDate = Long.MIN_VALUE;
}
Date modifiedDate = getModifiedDate();
if (modifiedDate != null) {
dictAttributeCacheModel.modifiedDate = modifiedDate.getTime();
}
else {
dictAttributeCacheModel.modifiedDate = Long.MIN_VALUE;
}
dictAttributeCacheModel.collectionName = getCollectionName();
String collectionName = dictAttributeCacheModel.collectionName;
if ((collectionName != null) && (collectionName.length() == 0)) {
dictAttributeCacheModel.collectionName = null;
}
dictAttributeCacheModel.name = getName();
String name = dictAttributeCacheModel.name;
if ((name != null) && (name.length() == 0)) {
dictAttributeCacheModel.name = null;
}
dictAttributeCacheModel.title = getTitle();
String title = dictAttributeCacheModel.title;
if ((title != null) && (title.length() == 0)) {
dictAttributeCacheModel.title = null;
}
dictAttributeCacheModel.dataType = getDataType();
String dataType = dictAttributeCacheModel.dataType;
if ((dataType != null) && (dataType.length() == 0)) {
dictAttributeCacheModel.dataType = null;
}
return dictAttributeCacheModel;
}
@Override
public String toString() {
StringBundler sb = new StringBundler(21);
sb.append("{dictAttributeId=");
sb.append(getDictAttributeId());
sb.append(", companyId=");
sb.append(getCompanyId());
sb.append(", groupId=");
sb.append(getGroupId());
sb.append(", userId=");
sb.append(getUserId());
sb.append(", createDate=");
sb.append(getCreateDate());
sb.append(", modifiedDate=");
sb.append(getModifiedDate());
sb.append(", collectionName=");
sb.append(getCollectionName());
sb.append(", name=");
sb.append(getName());
sb.append(", title=");
sb.append(getTitle());
sb.append(", dataType=");
sb.append(getDataType());
sb.append("}");
return sb.toString();
}
@Override
public String toXmlString() {
StringBundler sb = new StringBundler(34);
sb.append("<model><model-name>");
sb.append("org.oep.datamgt.model.DictAttribute");
sb.append("</model-name>");
sb.append(
"<column><column-name>dictAttributeId</column-name><column-value><![CDATA[");
sb.append(getDictAttributeId());
sb.append("]]></column-value></column>");
sb.append(
"<column><column-name>companyId</column-name><column-value><![CDATA[");
sb.append(getCompanyId());
sb.append("]]></column-value></column>");
sb.append(
"<column><column-name>groupId</column-name><column-value><![CDATA[");
sb.append(getGroupId());
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(
"<column><column-name>collectionName</column-name><column-value><![CDATA[");
sb.append(getCollectionName());
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(
"<column><column-name>title</column-name><column-value><![CDATA[");
sb.append(getTitle());
sb.append("]]></column-value></column>");
sb.append(
"<column><column-name>dataType</column-name><column-value><![CDATA[");
sb.append(getDataType());
sb.append("]]></column-value></column>");
sb.append("</model>");
return sb.toString();
}
private static ClassLoader _classLoader = DictAttribute.class.getClassLoader();
private static Class<?>[] _escapedModelInterfaces = new Class[] {
DictAttribute.class
};
private long _dictAttributeId;
private long _companyId;
private long _originalCompanyId;
private boolean _setOriginalCompanyId;
private long _groupId;
private long _originalGroupId;
private boolean _setOriginalGroupId;
private long _userId;
private String _userUuid;
private Date _createDate;
private Date _modifiedDate;
private String _collectionName;
private String _originalCollectionName;
private String _name;
private String _title;
private String _dataType;
private String _originalDataType;
private long _columnBitmask;
private DictAttribute _escapedModel;
}