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