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