1
22
23 package com.liferay.portal.model.impl;
24
25 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
26 import com.liferay.portal.kernel.util.GetterUtil;
27 import com.liferay.portal.kernel.util.HtmlUtil;
28 import com.liferay.portal.kernel.util.StringBundler;
29 import com.liferay.portal.model.ListType;
30 import com.liferay.portal.model.ListTypeSoap;
31
32 import java.io.Serializable;
33
34 import java.lang.reflect.Proxy;
35
36 import java.sql.Types;
37
38 import java.util.ArrayList;
39 import java.util.List;
40
41
60 public class ListTypeModelImpl extends BaseModelImpl<ListType> {
61 public static final String TABLE_NAME = "ListType";
62 public static final Object[][] TABLE_COLUMNS = {
63 { "listTypeId", new Integer(Types.INTEGER) },
64 { "name", new Integer(Types.VARCHAR) },
65 { "type_", new Integer(Types.VARCHAR) }
66 };
67 public static final String TABLE_SQL_CREATE = "create table ListType (listTypeId INTEGER not null primary key,name VARCHAR(75) null,type_ VARCHAR(75) null)";
68 public static final String TABLE_SQL_DROP = "drop table ListType";
69 public static final String ORDER_BY_JPQL = " ORDER BY listType.name ASC";
70 public static final String ORDER_BY_SQL = " ORDER BY ListType.name ASC";
71 public static final String DATA_SOURCE = "liferayDataSource";
72 public static final String SESSION_FACTORY = "liferaySessionFactory";
73 public static final String TX_MANAGER = "liferayTransactionManager";
74 public static final boolean ENTITY_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
75 "value.object.entity.cache.enabled.com.liferay.portal.model.ListType"),
76 true);
77 public static final boolean FINDER_CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
78 "value.object.finder.cache.enabled.com.liferay.portal.model.ListType"),
79 true);
80
81 public static ListType toModel(ListTypeSoap soapModel) {
82 ListType model = new ListTypeImpl();
83
84 model.setListTypeId(soapModel.getListTypeId());
85 model.setName(soapModel.getName());
86 model.setType(soapModel.getType());
87
88 return model;
89 }
90
91 public static List<ListType> toModels(ListTypeSoap[] soapModels) {
92 List<ListType> models = new ArrayList<ListType>(soapModels.length);
93
94 for (ListTypeSoap soapModel : soapModels) {
95 models.add(toModel(soapModel));
96 }
97
98 return models;
99 }
100
101 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
102 "lock.expiration.time.com.liferay.portal.model.ListType"));
103
104 public ListTypeModelImpl() {
105 }
106
107 public int getPrimaryKey() {
108 return _listTypeId;
109 }
110
111 public void setPrimaryKey(int pk) {
112 setListTypeId(pk);
113 }
114
115 public Serializable getPrimaryKeyObj() {
116 return new Integer(_listTypeId);
117 }
118
119 public int getListTypeId() {
120 return _listTypeId;
121 }
122
123 public void setListTypeId(int listTypeId) {
124 _listTypeId = listTypeId;
125 }
126
127 public String getName() {
128 return GetterUtil.getString(_name);
129 }
130
131 public void setName(String name) {
132 _name = name;
133 }
134
135 public String getType() {
136 return GetterUtil.getString(_type);
137 }
138
139 public void setType(String type) {
140 _type = type;
141 }
142
143 public ListType toEscapedModel() {
144 if (isEscapedModel()) {
145 return (ListType)this;
146 }
147 else {
148 ListType model = new ListTypeImpl();
149
150 model.setNew(isNew());
151 model.setEscapedModel(true);
152
153 model.setListTypeId(getListTypeId());
154 model.setName(HtmlUtil.escape(getName()));
155 model.setType(HtmlUtil.escape(getType()));
156
157 model = (ListType)Proxy.newProxyInstance(ListType.class.getClassLoader(),
158 new Class[] { ListType.class },
159 new ReadOnlyBeanHandler(model));
160
161 return model;
162 }
163 }
164
165 public Object clone() {
166 ListTypeImpl clone = new ListTypeImpl();
167
168 clone.setListTypeId(getListTypeId());
169 clone.setName(getName());
170 clone.setType(getType());
171
172 return clone;
173 }
174
175 public int compareTo(ListType listType) {
176 int value = 0;
177
178 value = getName().toLowerCase()
179 .compareTo(listType.getName().toLowerCase());
180
181 if (value != 0) {
182 return value;
183 }
184
185 return 0;
186 }
187
188 public boolean equals(Object obj) {
189 if (obj == null) {
190 return false;
191 }
192
193 ListType listType = null;
194
195 try {
196 listType = (ListType)obj;
197 }
198 catch (ClassCastException cce) {
199 return false;
200 }
201
202 int pk = listType.getPrimaryKey();
203
204 if (getPrimaryKey() == pk) {
205 return true;
206 }
207 else {
208 return false;
209 }
210 }
211
212 public int hashCode() {
213 return getPrimaryKey();
214 }
215
216 public String toString() {
217 StringBundler sb = new StringBundler(7);
218
219 sb.append("{listTypeId=");
220 sb.append(getListTypeId());
221 sb.append(", name=");
222 sb.append(getName());
223 sb.append(", type=");
224 sb.append(getType());
225 sb.append("}");
226
227 return sb.toString();
228 }
229
230 public String toXmlString() {
231 StringBundler sb = new StringBundler(13);
232
233 sb.append("<model><model-name>");
234 sb.append("com.liferay.portal.model.ListType");
235 sb.append("</model-name>");
236
237 sb.append(
238 "<column><column-name>listTypeId</column-name><column-value><![CDATA[");
239 sb.append(getListTypeId());
240 sb.append("]]></column-value></column>");
241 sb.append(
242 "<column><column-name>name</column-name><column-value><![CDATA[");
243 sb.append(getName());
244 sb.append("]]></column-value></column>");
245 sb.append(
246 "<column><column-name>type</column-name><column-value><![CDATA[");
247 sb.append(getType());
248 sb.append("]]></column-value></column>");
249
250 sb.append("</model>");
251
252 return sb.toString();
253 }
254
255 private int _listTypeId;
256 private String _name;
257 private String _type;
258 }