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