/** * 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.DictCollection; import org.oep.datamgt.model.DictCollectionModel; import org.oep.datamgt.model.DictCollectionSoap; 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 DictCollection service. Represents a row in the "oep_datamgt_dictcollection" database table, with each column mapped to a property of this class. * * <p> * This implementation and its corresponding interface {@link org.oep.datamgt.model.DictCollectionModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link DictCollectionImpl}. * </p> * * @author NQMINH * @see DictCollectionImpl * @see org.oep.datamgt.model.DictCollection * @see org.oep.datamgt.model.DictCollectionModel * @generated */ @JSON(strict = true) public class DictCollectionModelImpl extends BaseModelImpl<DictCollection> implements DictCollectionModel { /* * NOTE FOR DEVELOPERS: * * Never modify or reference this class directly. All methods that expect a dictionary collection model instance should use the {@link org.oep.datamgt.model.DictCollection} interface instead. */ public static final String TABLE_NAME = "oep_datamgt_dictcollection"; public static final Object[][] TABLE_COLUMNS = { { "dictCollectionId", Types.BIGINT }, { "companyId", Types.BIGINT }, { "groupId", Types.BIGINT }, { "userId", Types.BIGINT }, { "createDate", Types.TIMESTAMP }, { "modifiedDate", Types.TIMESTAMP }, { "name", Types.VARCHAR }, { "version", Types.VARCHAR }, { "title", Types.VARCHAR }, { "validatedFrom", Types.TIMESTAMP }, { "validatedTo", Types.TIMESTAMP }, { "status", Types.INTEGER } }; public static final String TABLE_SQL_CREATE = "create table oep_datamgt_dictcollection (dictCollectionId LONG not null primary key,companyId LONG,groupId LONG,userId LONG,createDate DATE null,modifiedDate DATE null,name VARCHAR(75) null,version VARCHAR(75) null,title VARCHAR(75) null,validatedFrom DATE null,validatedTo DATE null,status INTEGER)"; public static final String TABLE_SQL_DROP = "drop table oep_datamgt_dictcollection"; public static final String ORDER_BY_JPQL = " ORDER BY dictCollection.dictCollectionId ASC"; public static final String ORDER_BY_SQL = " ORDER BY oep_datamgt_dictcollection.dictCollectionId 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.DictCollection"), 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.DictCollection"), 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.DictCollection"), true); public static long COMPANYID_COLUMN_BITMASK = 1L; public static long GROUPID_COLUMN_BITMASK = 2L; public static long NAME_COLUMN_BITMASK = 4L; public static long STATUS_COLUMN_BITMASK = 8L; public static long VERSION_COLUMN_BITMASK = 16L; public static long DICTCOLLECTIONID_COLUMN_BITMASK = 32L; /** * 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 DictCollection toModel(DictCollectionSoap soapModel) { if (soapModel == null) { return null; } DictCollection model = new DictCollectionImpl(); model.setDictCollectionId(soapModel.getDictCollectionId()); model.setCompanyId(soapModel.getCompanyId()); model.setGroupId(soapModel.getGroupId()); model.setUserId(soapModel.getUserId()); model.setCreateDate(soapModel.getCreateDate()); model.setModifiedDate(soapModel.getModifiedDate()); model.setName(soapModel.getName()); model.setVersion(soapModel.getVersion()); model.setTitle(soapModel.getTitle()); model.setValidatedFrom(soapModel.getValidatedFrom()); model.setValidatedTo(soapModel.getValidatedTo()); model.setStatus(soapModel.getStatus()); 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<DictCollection> toModels(DictCollectionSoap[] soapModels) { if (soapModels == null) { return null; } List<DictCollection> models = new ArrayList<DictCollection>(soapModels.length); for (DictCollectionSoap soapModel : soapModels) { models.add(toModel(soapModel)); } return models; } public static final String MAPPING_TABLE_OEP_DATAMGT_DICTDATA2COLLECTION_NAME = "oep_datamgt_dictdata2collection"; public static final Object[][] MAPPING_TABLE_OEP_DATAMGT_DICTDATA2COLLECTION_COLUMNS = { { "dictCollectionId", Types.BIGINT }, { "dictDataId", Types.BIGINT } }; public static final String MAPPING_TABLE_OEP_DATAMGT_DICTDATA2COLLECTION_SQL_CREATE = "create table oep_datamgt_dictdata2collection (dictCollectionId LONG not null,dictDataId LONG not null,primary key (dictCollectionId, dictDataId))"; public static final boolean FINDER_CACHE_ENABLED_OEP_DATAMGT_DICTDATA2COLLECTION = GetterUtil.getBoolean(com.liferay.util.service.ServiceProps.get( "value.object.finder.cache.enabled.oep_datamgt_dictdata2collection"), true); public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.util.service.ServiceProps.get( "lock.expiration.time.org.oep.datamgt.model.DictCollection")); public DictCollectionModelImpl() { } @Override public long getPrimaryKey() { return _dictCollectionId; } @Override public void setPrimaryKey(long primaryKey) { setDictCollectionId(primaryKey); } @Override public Serializable getPrimaryKeyObj() { return _dictCollectionId; } @Override public void setPrimaryKeyObj(Serializable primaryKeyObj) { setPrimaryKey(((Long)primaryKeyObj).longValue()); } @Override public Class<?> getModelClass() { return DictCollection.class; } @Override public String getModelClassName() { return DictCollection.class.getName(); } @Override public Map<String, Object> getModelAttributes() { Map<String, Object> attributes = new HashMap<String, Object>(); attributes.put("dictCollectionId", getDictCollectionId()); attributes.put("companyId", getCompanyId()); attributes.put("groupId", getGroupId()); attributes.put("userId", getUserId()); attributes.put("createDate", getCreateDate()); attributes.put("modifiedDate", getModifiedDate()); attributes.put("name", getName()); attributes.put("version", getVersion()); attributes.put("title", getTitle()); attributes.put("validatedFrom", getValidatedFrom()); attributes.put("validatedTo", getValidatedTo()); attributes.put("status", getStatus()); return attributes; } @Override public void setModelAttributes(Map<String, Object> attributes) { Long dictCollectionId = (Long)attributes.get("dictCollectionId"); if (dictCollectionId != null) { setDictCollectionId(dictCollectionId); } 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 name = (String)attributes.get("name"); if (name != null) { setName(name); } String version = (String)attributes.get("version"); if (version != null) { setVersion(version); } String title = (String)attributes.get("title"); if (title != null) { setTitle(title); } Date validatedFrom = (Date)attributes.get("validatedFrom"); if (validatedFrom != null) { setValidatedFrom(validatedFrom); } Date validatedTo = (Date)attributes.get("validatedTo"); if (validatedTo != null) { setValidatedTo(validatedTo); } Integer status = (Integer)attributes.get("status"); if (status != null) { setStatus(status); } } @JSON @Override public long getDictCollectionId() { return _dictCollectionId; } @Override public void setDictCollectionId(long dictCollectionId) { _dictCollectionId = dictCollectionId; } @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 getName() { if (_name == null) { return StringPool.BLANK; } else { return _name; } } @Override public void setName(String name) { _columnBitmask |= NAME_COLUMN_BITMASK; if (_originalName == null) { _originalName = _name; } _name = name; } public String getOriginalName() { return GetterUtil.getString(_originalName); } @JSON @Override public String getVersion() { if (_version == null) { return StringPool.BLANK; } else { return _version; } } @Override public void setVersion(String version) { _columnBitmask |= VERSION_COLUMN_BITMASK; if (_originalVersion == null) { _originalVersion = _version; } _version = version; } public String getOriginalVersion() { return GetterUtil.getString(_originalVersion); } @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 Date getValidatedFrom() { return _validatedFrom; } @Override public void setValidatedFrom(Date validatedFrom) { _validatedFrom = validatedFrom; } @JSON @Override public Date getValidatedTo() { return _validatedTo; } @Override public void setValidatedTo(Date validatedTo) { _validatedTo = validatedTo; } @JSON @Override public int getStatus() { return _status; } @Override public void setStatus(int status) { _columnBitmask |= STATUS_COLUMN_BITMASK; if (!_setOriginalStatus) { _setOriginalStatus = true; _originalStatus = _status; } _status = status; } public int getOriginalStatus() { return _originalStatus; } public long getColumnBitmask() { return _columnBitmask; } @Override public ExpandoBridge getExpandoBridge() { return ExpandoBridgeFactoryUtil.getExpandoBridge(getCompanyId(), DictCollection.class.getName(), getPrimaryKey()); } @Override public void setExpandoBridgeAttributes(ServiceContext serviceContext) { ExpandoBridge expandoBridge = getExpandoBridge(); expandoBridge.setAttributes(serviceContext); } @Override public DictCollection toEscapedModel() { if (_escapedModel == null) { _escapedModel = (DictCollection)ProxyUtil.newProxyInstance(_classLoader, _escapedModelInterfaces, new AutoEscapeBeanHandler(this)); } return _escapedModel; } @Override public Object clone() { DictCollectionImpl dictCollectionImpl = new DictCollectionImpl(); dictCollectionImpl.setDictCollectionId(getDictCollectionId()); dictCollectionImpl.setCompanyId(getCompanyId()); dictCollectionImpl.setGroupId(getGroupId()); dictCollectionImpl.setUserId(getUserId()); dictCollectionImpl.setCreateDate(getCreateDate()); dictCollectionImpl.setModifiedDate(getModifiedDate()); dictCollectionImpl.setName(getName()); dictCollectionImpl.setVersion(getVersion()); dictCollectionImpl.setTitle(getTitle()); dictCollectionImpl.setValidatedFrom(getValidatedFrom()); dictCollectionImpl.setValidatedTo(getValidatedTo()); dictCollectionImpl.setStatus(getStatus()); dictCollectionImpl.resetOriginalValues(); return dictCollectionImpl; } @Override public int compareTo(DictCollection dictCollection) { long primaryKey = dictCollection.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 DictCollection)) { return false; } DictCollection dictCollection = (DictCollection)obj; long primaryKey = dictCollection.getPrimaryKey(); if (getPrimaryKey() == primaryKey) { return true; } else { return false; } } @Override public int hashCode() { return (int)getPrimaryKey(); } @Override public void resetOriginalValues() { DictCollectionModelImpl dictCollectionModelImpl = this; dictCollectionModelImpl._originalCompanyId = dictCollectionModelImpl._companyId; dictCollectionModelImpl._setOriginalCompanyId = false; dictCollectionModelImpl._originalGroupId = dictCollectionModelImpl._groupId; dictCollectionModelImpl._setOriginalGroupId = false; dictCollectionModelImpl._originalName = dictCollectionModelImpl._name; dictCollectionModelImpl._originalVersion = dictCollectionModelImpl._version; dictCollectionModelImpl._originalStatus = dictCollectionModelImpl._status; dictCollectionModelImpl._setOriginalStatus = false; dictCollectionModelImpl._columnBitmask = 0; } @Override public CacheModel<DictCollection> toCacheModel() { DictCollectionCacheModel dictCollectionCacheModel = new DictCollectionCacheModel(); dictCollectionCacheModel.dictCollectionId = getDictCollectionId(); dictCollectionCacheModel.companyId = getCompanyId(); dictCollectionCacheModel.groupId = getGroupId(); dictCollectionCacheModel.userId = getUserId(); Date createDate = getCreateDate(); if (createDate != null) { dictCollectionCacheModel.createDate = createDate.getTime(); } else { dictCollectionCacheModel.createDate = Long.MIN_VALUE; } Date modifiedDate = getModifiedDate(); if (modifiedDate != null) { dictCollectionCacheModel.modifiedDate = modifiedDate.getTime(); } else { dictCollectionCacheModel.modifiedDate = Long.MIN_VALUE; } dictCollectionCacheModel.name = getName(); String name = dictCollectionCacheModel.name; if ((name != null) && (name.length() == 0)) { dictCollectionCacheModel.name = null; } dictCollectionCacheModel.version = getVersion(); String version = dictCollectionCacheModel.version; if ((version != null) && (version.length() == 0)) { dictCollectionCacheModel.version = null; } dictCollectionCacheModel.title = getTitle(); String title = dictCollectionCacheModel.title; if ((title != null) && (title.length() == 0)) { dictCollectionCacheModel.title = null; } Date validatedFrom = getValidatedFrom(); if (validatedFrom != null) { dictCollectionCacheModel.validatedFrom = validatedFrom.getTime(); } else { dictCollectionCacheModel.validatedFrom = Long.MIN_VALUE; } Date validatedTo = getValidatedTo(); if (validatedTo != null) { dictCollectionCacheModel.validatedTo = validatedTo.getTime(); } else { dictCollectionCacheModel.validatedTo = Long.MIN_VALUE; } dictCollectionCacheModel.status = getStatus(); return dictCollectionCacheModel; } @Override public String toString() { StringBundler sb = new StringBundler(25); sb.append("{dictCollectionId="); sb.append(getDictCollectionId()); 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(", name="); sb.append(getName()); sb.append(", version="); sb.append(getVersion()); sb.append(", title="); sb.append(getTitle()); sb.append(", validatedFrom="); sb.append(getValidatedFrom()); sb.append(", validatedTo="); sb.append(getValidatedTo()); sb.append(", status="); sb.append(getStatus()); sb.append("}"); return sb.toString(); } @Override public String toXmlString() { StringBundler sb = new StringBundler(40); sb.append("<model><model-name>"); sb.append("org.oep.datamgt.model.DictCollection"); sb.append("</model-name>"); sb.append( "<column><column-name>dictCollectionId</column-name><column-value><![CDATA["); sb.append(getDictCollectionId()); 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>name</column-name><column-value><![CDATA["); sb.append(getName()); sb.append("]]></column-value></column>"); sb.append( "<column><column-name>version</column-name><column-value><![CDATA["); sb.append(getVersion()); 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>validatedFrom</column-name><column-value><![CDATA["); sb.append(getValidatedFrom()); sb.append("]]></column-value></column>"); sb.append( "<column><column-name>validatedTo</column-name><column-value><![CDATA["); sb.append(getValidatedTo()); 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("</model>"); return sb.toString(); } private static ClassLoader _classLoader = DictCollection.class.getClassLoader(); private static Class<?>[] _escapedModelInterfaces = new Class[] { DictCollection.class }; private long _dictCollectionId; 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 _name; private String _originalName; private String _version; private String _originalVersion; private String _title; private Date _validatedFrom; private Date _validatedTo; private int _status; private int _originalStatus; private boolean _setOriginalStatus; private long _columnBitmask; private DictCollection _escapedModel; }