1
14
15 package com.liferay.portal.model.impl;
16
17 import com.liferay.portal.kernel.bean.AutoEscapeBeanHandler;
18 import com.liferay.portal.kernel.util.GetterUtil;
19 import com.liferay.portal.kernel.util.StringBundler;
20 import com.liferay.portal.kernel.util.StringPool;
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 if (_name == null) {
121 return StringPool.BLANK;
122 }
123 else {
124 return _name;
125 }
126 }
127
128 public void setName(String name) {
129 _name = name;
130 }
131
132 public String getType() {
133 if (_type == null) {
134 return StringPool.BLANK;
135 }
136 else {
137 return _type;
138 }
139 }
140
141 public void setType(String type) {
142 _type = type;
143 }
144
145 public ListType toEscapedModel() {
146 if (isEscapedModel()) {
147 return (ListType)this;
148 }
149 else {
150 return (ListType)Proxy.newProxyInstance(ListType.class.getClassLoader(),
151 new Class[] { ListType.class }, new AutoEscapeBeanHandler(this));
152 }
153 }
154
155 public Object clone() {
156 ListTypeImpl clone = new ListTypeImpl();
157
158 clone.setListTypeId(getListTypeId());
159 clone.setName(getName());
160 clone.setType(getType());
161
162 return clone;
163 }
164
165 public int compareTo(ListType listType) {
166 int value = 0;
167
168 value = getName().toLowerCase()
169 .compareTo(listType.getName().toLowerCase());
170
171 if (value != 0) {
172 return value;
173 }
174
175 return 0;
176 }
177
178 public boolean equals(Object obj) {
179 if (obj == null) {
180 return false;
181 }
182
183 ListType listType = null;
184
185 try {
186 listType = (ListType)obj;
187 }
188 catch (ClassCastException cce) {
189 return false;
190 }
191
192 int pk = listType.getPrimaryKey();
193
194 if (getPrimaryKey() == pk) {
195 return true;
196 }
197 else {
198 return false;
199 }
200 }
201
202 public int hashCode() {
203 return getPrimaryKey();
204 }
205
206 public String toString() {
207 StringBundler sb = new StringBundler(7);
208
209 sb.append("{listTypeId=");
210 sb.append(getListTypeId());
211 sb.append(", name=");
212 sb.append(getName());
213 sb.append(", type=");
214 sb.append(getType());
215 sb.append("}");
216
217 return sb.toString();
218 }
219
220 public String toXmlString() {
221 StringBundler sb = new StringBundler(13);
222
223 sb.append("<model><model-name>");
224 sb.append("com.liferay.portal.model.ListType");
225 sb.append("</model-name>");
226
227 sb.append(
228 "<column><column-name>listTypeId</column-name><column-value><![CDATA[");
229 sb.append(getListTypeId());
230 sb.append("]]></column-value></column>");
231 sb.append(
232 "<column><column-name>name</column-name><column-value><![CDATA[");
233 sb.append(getName());
234 sb.append("]]></column-value></column>");
235 sb.append(
236 "<column><column-name>type</column-name><column-value><![CDATA[");
237 sb.append(getType());
238 sb.append("]]></column-value></column>");
239
240 sb.append("</model>");
241
242 return sb.toString();
243 }
244
245 private int _listTypeId;
246 private String _name;
247 private String _type;
248 }