001
014
015 package com.liferay.portal.model.impl;
016
017 import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
018 import com.liferay.portal.kernel.util.GetterUtil;
019 import com.liferay.portal.kernel.util.StringBundler;
020 import com.liferay.portal.kernel.util.StringPool;
021 import com.liferay.portal.model.ListType;
022 import com.liferay.portal.model.ListTypeModel;
023 import com.liferay.portal.model.ListTypeSoap;
024
025 import java.io.Serializable;
026
027 import java.lang.reflect.Proxy;
028
029 import java.sql.Types;
030
031 import java.util.ArrayList;
032 import java.util.List;
033
034
046 public class ListTypeModelImpl extends BaseModelImpl<ListType>
047 implements ListTypeModel {
048 public static final String TABLE_NAME = "ListType";
049 public static final Object[][] TABLE_COLUMNS = {
050 { "listTypeId", new Integer(Types.INTEGER) },
051 { "name", new Integer(Types.VARCHAR) },
052 { "type_", new Integer(Types.VARCHAR) }
053 };
054 public static final String TABLE_SQL_CREATE = "create table ListType (listTypeId INTEGER not null primary key,name VARCHAR(75) null,type_ VARCHAR(75) null)";
055 public static final String TABLE_SQL_DROP = "drop table ListType";
056 public static final String ORDER_BY_JPQL = " ORDER BY listType.name ASC";
057 public static final String ORDER_BY_SQL = " ORDER BY ListType.name ASC";
058 public static final String DATA_SOURCE = "liferayDataSource";
059 public static final String SESSION_FACTORY = "liferaySessionFactory";
060 public static final String TX_MANAGER = "liferayTransactionManager";
061 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
062 "value.object.entity.cache.enabled.com.liferay.portal.model.ListType"),
063 true);
064 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
065 "value.object.finder.cache.enabled.com.liferay.portal.model.ListType"),
066 true);
067
068 public static ListType toModel(ListTypeSoap soapModel) {
069 ListType model = new ListTypeImpl();
070
071 model.setListTypeId(soapModel.getListTypeId());
072 model.setName(soapModel.getName());
073 model.setType(soapModel.getType());
074
075 return model;
076 }
077
078 public static List<ListType> toModels(ListTypeSoap[] soapModels) {
079 List<ListType> models = new ArrayList<ListType>(soapModels.length);
080
081 for (ListTypeSoap soapModel : soapModels) {
082 models.add(toModel(soapModel));
083 }
084
085 return models;
086 }
087
088 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
089 "lock.expiration.time.com.liferay.portal.model.ListType"));
090
091 public ListTypeModelImpl() {
092 }
093
094 public int getPrimaryKey() {
095 return _listTypeId;
096 }
097
098 public void setPrimaryKey(int pk) {
099 setListTypeId(pk);
100 }
101
102 public Serializable getPrimaryKeyObj() {
103 return new Integer(_listTypeId);
104 }
105
106 public int getListTypeId() {
107 return _listTypeId;
108 }
109
110 public void setListTypeId(int listTypeId) {
111 _listTypeId = listTypeId;
112 }
113
114 public String getName() {
115 if (_name == null) {
116 return StringPool.BLANK;
117 }
118 else {
119 return _name;
120 }
121 }
122
123 public void setName(String name) {
124 _name = name;
125 }
126
127 public String getType() {
128 if (_type == null) {
129 return StringPool.BLANK;
130 }
131 else {
132 return _type;
133 }
134 }
135
136 public void setType(String type) {
137 _type = type;
138 }
139
140 public ListType toEscapedModel() {
141 if (isEscapedModel()) {
142 return (ListType)this;
143 }
144 else {
145 return (ListType)Proxy.newProxyInstance(ListType.class.getClassLoader(),
146 new Class[] { ListType.class }, new AutoEscapeBeanHandler(this));
147 }
148 }
149
150 public Object clone() {
151 ListTypeImpl clone = new ListTypeImpl();
152
153 clone.setListTypeId(getListTypeId());
154 clone.setName(getName());
155 clone.setType(getType());
156
157 return clone;
158 }
159
160 public int compareTo(ListType listType) {
161 int value = 0;
162
163 value = getName().toLowerCase()
164 .compareTo(listType.getName().toLowerCase());
165
166 if (value != 0) {
167 return value;
168 }
169
170 return 0;
171 }
172
173 public boolean equals(Object obj) {
174 if (obj == null) {
175 return false;
176 }
177
178 ListType listType = null;
179
180 try {
181 listType = (ListType)obj;
182 }
183 catch (ClassCastException cce) {
184 return false;
185 }
186
187 int pk = listType.getPrimaryKey();
188
189 if (getPrimaryKey() == pk) {
190 return true;
191 }
192 else {
193 return false;
194 }
195 }
196
197 public int hashCode() {
198 return getPrimaryKey();
199 }
200
201 public String toString() {
202 StringBundler sb = new StringBundler(7);
203
204 sb.append("{listTypeId=");
205 sb.append(getListTypeId());
206 sb.append(", name=");
207 sb.append(getName());
208 sb.append(", type=");
209 sb.append(getType());
210 sb.append("}");
211
212 return sb.toString();
213 }
214
215 public String toXmlString() {
216 StringBundler sb = new StringBundler(13);
217
218 sb.append("<model><model-name>");
219 sb.append("com.liferay.portal.model.ListType");
220 sb.append("</model-name>");
221
222 sb.append(
223 "<column><column-name>listTypeId</column-name><column-value><![CDATA[");
224 sb.append(getListTypeId());
225 sb.append("]]></column-value></column>");
226 sb.append(
227 "<column><column-name>name</column-name><column-value><![CDATA[");
228 sb.append(getName());
229 sb.append("]]></column-value></column>");
230 sb.append(
231 "<column><column-name>type</column-name><column-value><![CDATA[");
232 sb.append(getType());
233 sb.append("]]></column-value></column>");
234
235 sb.append("</model>");
236
237 return sb.toString();
238 }
239
240 private int _listTypeId;
241 private String _name;
242 private String _type;
243 }