/** * 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 com.liferay.portal.model.impl; import aQute.bnd.annotation.ProviderType; import com.liferay.expando.kernel.model.ExpandoBridge; import com.liferay.expando.kernel.util.ExpandoBridgeFactoryUtil; import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler; import com.liferay.portal.kernel.json.JSON; import com.liferay.portal.kernel.model.CacheModel; import com.liferay.portal.kernel.model.ListType; import com.liferay.portal.kernel.model.ListTypeModel; import com.liferay.portal.kernel.model.ListTypeSoap; import com.liferay.portal.kernel.model.impl.BaseModelImpl; import com.liferay.portal.kernel.service.ServiceContext; 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 java.io.Serializable; import java.sql.Types; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; /** * The base model implementation for the ListType service. Represents a row in the "ListType" database table, with each column mapped to a property of this class. * * <p> * This implementation and its corresponding interface {@link ListTypeModel} exist only as a container for the default property accessors generated by ServiceBuilder. Helper methods and all application logic should be put in {@link ListTypeImpl}. * </p> * * @author Brian Wing Shun Chan * @see ListTypeImpl * @see ListType * @see ListTypeModel * @generated */ @JSON(strict = true) @ProviderType public class ListTypeModelImpl extends BaseModelImpl<ListType> implements ListTypeModel { /* * NOTE FOR DEVELOPERS: * * Never modify or reference this class directly. All methods that expect a list type model instance should use the {@link ListType} interface instead. */ public static final String TABLE_NAME = "ListType"; public static final Object[][] TABLE_COLUMNS = { { "mvccVersion", Types.BIGINT }, { "listTypeId", Types.BIGINT }, { "name", Types.VARCHAR }, { "type_", Types.VARCHAR } }; public static final Map<String, Integer> TABLE_COLUMNS_MAP = new HashMap<String, Integer>(); static { TABLE_COLUMNS_MAP.put("mvccVersion", Types.BIGINT); TABLE_COLUMNS_MAP.put("listTypeId", Types.BIGINT); TABLE_COLUMNS_MAP.put("name", Types.VARCHAR); TABLE_COLUMNS_MAP.put("type_", Types.VARCHAR); } public static final String TABLE_SQL_CREATE = "create table ListType (mvccVersion LONG default 0 not null,listTypeId LONG not null primary key,name VARCHAR(75) null,type_ VARCHAR(75) null)"; public static final String TABLE_SQL_DROP = "drop table ListType"; public static final String ORDER_BY_JPQL = " ORDER BY listType.name ASC"; public static final String ORDER_BY_SQL = " ORDER BY ListType.name 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.portal.kernel.model.ListType"), true); public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get( "value.object.finder.cache.enabled.com.liferay.portal.kernel.model.ListType"), true); public static final boolean COLUMN_BITMASK_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get( "value.object.column.bitmask.enabled.com.liferay.portal.kernel.model.ListType"), true); public static final long NAME_COLUMN_BITMASK = 1L; public static final long TYPE_COLUMN_BITMASK = 2L; /** * 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 ListType toModel(ListTypeSoap soapModel) { if (soapModel == null) { return null; } ListType model = new ListTypeImpl(); model.setMvccVersion(soapModel.getMvccVersion()); model.setListTypeId(soapModel.getListTypeId()); model.setName(soapModel.getName()); model.setType(soapModel.getType()); 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<ListType> toModels(ListTypeSoap[] soapModels) { if (soapModels == null) { return null; } List<ListType> models = new ArrayList<ListType>(soapModels.length); for (ListTypeSoap soapModel : soapModels) { models.add(toModel(soapModel)); } return models; } public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get( "lock.expiration.time.com.liferay.portal.kernel.model.ListType")); public ListTypeModelImpl() { } @Override public long getPrimaryKey() { return _listTypeId; } @Override public void setPrimaryKey(long primaryKey) { setListTypeId(primaryKey); } @Override public Serializable getPrimaryKeyObj() { return _listTypeId; } @Override public void setPrimaryKeyObj(Serializable primaryKeyObj) { setPrimaryKey(((Long)primaryKeyObj).longValue()); } @Override public Class<?> getModelClass() { return ListType.class; } @Override public String getModelClassName() { return ListType.class.getName(); } @Override public Map<String, Object> getModelAttributes() { Map<String, Object> attributes = new HashMap<String, Object>(); attributes.put("mvccVersion", getMvccVersion()); attributes.put("listTypeId", getListTypeId()); attributes.put("name", getName()); attributes.put("type", getType()); attributes.put("entityCacheEnabled", isEntityCacheEnabled()); attributes.put("finderCacheEnabled", isFinderCacheEnabled()); return attributes; } @Override public void setModelAttributes(Map<String, Object> attributes) { Long mvccVersion = (Long)attributes.get("mvccVersion"); if (mvccVersion != null) { setMvccVersion(mvccVersion); } Long listTypeId = (Long)attributes.get("listTypeId"); if (listTypeId != null) { setListTypeId(listTypeId); } String name = (String)attributes.get("name"); if (name != null) { setName(name); } String type = (String)attributes.get("type"); if (type != null) { setType(type); } } @JSON @Override public long getMvccVersion() { return _mvccVersion; } @Override public void setMvccVersion(long mvccVersion) { _mvccVersion = mvccVersion; } @JSON @Override public long getListTypeId() { return _listTypeId; } @Override public void setListTypeId(long listTypeId) { _listTypeId = listTypeId; } @JSON @Override public String getName() { if (_name == null) { return StringPool.BLANK; } else { return _name; } } @Override public void setName(String name) { _columnBitmask = -1L; if (_originalName == null) { _originalName = _name; } _name = name; } public String getOriginalName() { return GetterUtil.getString(_originalName); } @JSON @Override public String getType() { if (_type == null) { return StringPool.BLANK; } else { return _type; } } @Override public void setType(String type) { _columnBitmask |= TYPE_COLUMN_BITMASK; if (_originalType == null) { _originalType = _type; } _type = type; } public String getOriginalType() { return GetterUtil.getString(_originalType); } public long getColumnBitmask() { return _columnBitmask; } @Override public ExpandoBridge getExpandoBridge() { return ExpandoBridgeFactoryUtil.getExpandoBridge(0, ListType.class.getName(), getPrimaryKey()); } @Override public void setExpandoBridgeAttributes(ServiceContext serviceContext) { ExpandoBridge expandoBridge = getExpandoBridge(); expandoBridge.setAttributes(serviceContext); } @Override public ListType toEscapedModel() { if (_escapedModel == null) { _escapedModel = (ListType)ProxyUtil.newProxyInstance(_classLoader, _escapedModelInterfaces, new AutoEscapeBeanHandler(this)); } return _escapedModel; } @Override public Object clone() { ListTypeImpl listTypeImpl = new ListTypeImpl(); listTypeImpl.setMvccVersion(getMvccVersion()); listTypeImpl.setListTypeId(getListTypeId()); listTypeImpl.setName(getName()); listTypeImpl.setType(getType()); listTypeImpl.resetOriginalValues(); return listTypeImpl; } @Override public int compareTo(ListType listType) { int value = 0; value = getName().compareToIgnoreCase(listType.getName()); if (value != 0) { return value; } return 0; } @Override public boolean equals(Object obj) { if (this == obj) { return true; } if (!(obj instanceof ListType)) { return false; } ListType listType = (ListType)obj; long primaryKey = listType.getPrimaryKey(); if (getPrimaryKey() == primaryKey) { return true; } else { return false; } } @Override public int hashCode() { return (int)getPrimaryKey(); } @Override public boolean isEntityCacheEnabled() { return ENTITY_CACHE_ENABLED; } @Override public boolean isFinderCacheEnabled() { return FINDER_CACHE_ENABLED; } @Override public void resetOriginalValues() { ListTypeModelImpl listTypeModelImpl = this; listTypeModelImpl._originalName = listTypeModelImpl._name; listTypeModelImpl._originalType = listTypeModelImpl._type; listTypeModelImpl._columnBitmask = 0; } @Override public CacheModel<ListType> toCacheModel() { ListTypeCacheModel listTypeCacheModel = new ListTypeCacheModel(); listTypeCacheModel.mvccVersion = getMvccVersion(); listTypeCacheModel.listTypeId = getListTypeId(); listTypeCacheModel.name = getName(); String name = listTypeCacheModel.name; if ((name != null) && (name.length() == 0)) { listTypeCacheModel.name = null; } listTypeCacheModel.type = getType(); String type = listTypeCacheModel.type; if ((type != null) && (type.length() == 0)) { listTypeCacheModel.type = null; } return listTypeCacheModel; } @Override public String toString() { StringBundler sb = new StringBundler(9); sb.append("{mvccVersion="); sb.append(getMvccVersion()); sb.append(", listTypeId="); sb.append(getListTypeId()); sb.append(", name="); sb.append(getName()); sb.append(", type="); sb.append(getType()); sb.append("}"); return sb.toString(); } @Override public String toXmlString() { StringBundler sb = new StringBundler(16); sb.append("<model><model-name>"); sb.append("com.liferay.portal.kernel.model.ListType"); sb.append("</model-name>"); sb.append( "<column><column-name>mvccVersion</column-name><column-value><![CDATA["); sb.append(getMvccVersion()); sb.append("]]></column-value></column>"); sb.append( "<column><column-name>listTypeId</column-name><column-value><![CDATA["); sb.append(getListTypeId()); 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>type</column-name><column-value><![CDATA["); sb.append(getType()); sb.append("]]></column-value></column>"); sb.append("</model>"); return sb.toString(); } private static final ClassLoader _classLoader = ListType.class.getClassLoader(); private static final Class<?>[] _escapedModelInterfaces = new Class[] { ListType.class }; private long _mvccVersion; private long _listTypeId; private String _name; private String _originalName; private String _type; private String _originalType; private long _columnBitmask; private ListType _escapedModel; }