1
22
23 package com.liferay.portlet.messageboards.model.impl;
24
25 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
26 import com.liferay.portal.kernel.util.GetterUtil;
27 import com.liferay.portal.model.impl.BaseModelImpl;
28 import com.liferay.portal.util.PropsUtil;
29
30 import com.liferay.portlet.messageboards.model.MBCategory;
31
32 import com.liferay.util.Html;
33
34 import java.io.Serializable;
35
36 import java.lang.reflect.Proxy;
37
38 import java.sql.Types;
39
40 import java.util.Date;
41
42
62 public class MBCategoryModelImpl extends BaseModelImpl {
63 public static final String TABLE_NAME = "MBCategory";
64 public static final Object[][] TABLE_COLUMNS = {
65 { "uuid_", new Integer(Types.VARCHAR) },
66
67
68 { "categoryId", new Integer(Types.BIGINT) },
69
70
71 { "groupId", new Integer(Types.BIGINT) },
72
73
74 { "companyId", new Integer(Types.BIGINT) },
75
76
77 { "userId", new Integer(Types.BIGINT) },
78
79
80 { "userName", new Integer(Types.VARCHAR) },
81
82
83 { "createDate", new Integer(Types.TIMESTAMP) },
84
85
86 { "modifiedDate", new Integer(Types.TIMESTAMP) },
87
88
89 { "parentCategoryId", new Integer(Types.BIGINT) },
90
91
92 { "name", new Integer(Types.VARCHAR) },
93
94
95 { "description", new Integer(Types.VARCHAR) },
96
97
98 { "lastPostDate", new Integer(Types.TIMESTAMP) }
99 };
100 public static final String TABLE_SQL_CREATE = "create table MBCategory (uuid_ VARCHAR(75) null,categoryId LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,parentCategoryId LONG,name VARCHAR(75) null,description STRING null,lastPostDate DATE null)";
101 public static final String TABLE_SQL_DROP = "drop table MBCategory";
102 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
103 "value.object.finder.cache.enabled.com.liferay.portlet.messageboards.model.MBCategory"),
104 true);
105 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
106 "lock.expiration.time.com.liferay.portlet.messageboards.model.MBCategory"));
107
108 public MBCategoryModelImpl() {
109 }
110
111 public long getPrimaryKey() {
112 return _categoryId;
113 }
114
115 public void setPrimaryKey(long pk) {
116 setCategoryId(pk);
117 }
118
119 public Serializable getPrimaryKeyObj() {
120 return new Long(_categoryId);
121 }
122
123 public String getUuid() {
124 return GetterUtil.getString(_uuid);
125 }
126
127 public void setUuid(String uuid) {
128 if ((uuid != null) && (uuid != _uuid)) {
129 _uuid = uuid;
130 }
131 }
132
133 public long getCategoryId() {
134 return _categoryId;
135 }
136
137 public void setCategoryId(long categoryId) {
138 if (categoryId != _categoryId) {
139 _categoryId = categoryId;
140 }
141 }
142
143 public long getGroupId() {
144 return _groupId;
145 }
146
147 public void setGroupId(long groupId) {
148 if (groupId != _groupId) {
149 _groupId = groupId;
150 }
151 }
152
153 public long getCompanyId() {
154 return _companyId;
155 }
156
157 public void setCompanyId(long companyId) {
158 if (companyId != _companyId) {
159 _companyId = companyId;
160 }
161 }
162
163 public long getUserId() {
164 return _userId;
165 }
166
167 public void setUserId(long userId) {
168 if (userId != _userId) {
169 _userId = userId;
170 }
171 }
172
173 public String getUserName() {
174 return GetterUtil.getString(_userName);
175 }
176
177 public void setUserName(String userName) {
178 if (((userName == null) && (_userName != null)) ||
179 ((userName != null) && (_userName == null)) ||
180 ((userName != null) && (_userName != null) &&
181 !userName.equals(_userName))) {
182 _userName = userName;
183 }
184 }
185
186 public Date getCreateDate() {
187 return _createDate;
188 }
189
190 public void setCreateDate(Date createDate) {
191 if (((createDate == null) && (_createDate != null)) ||
192 ((createDate != null) && (_createDate == null)) ||
193 ((createDate != null) && (_createDate != null) &&
194 !createDate.equals(_createDate))) {
195 _createDate = createDate;
196 }
197 }
198
199 public Date getModifiedDate() {
200 return _modifiedDate;
201 }
202
203 public void setModifiedDate(Date modifiedDate) {
204 if (((modifiedDate == null) && (_modifiedDate != null)) ||
205 ((modifiedDate != null) && (_modifiedDate == null)) ||
206 ((modifiedDate != null) && (_modifiedDate != null) &&
207 !modifiedDate.equals(_modifiedDate))) {
208 _modifiedDate = modifiedDate;
209 }
210 }
211
212 public long getParentCategoryId() {
213 return _parentCategoryId;
214 }
215
216 public void setParentCategoryId(long parentCategoryId) {
217 if (parentCategoryId != _parentCategoryId) {
218 _parentCategoryId = parentCategoryId;
219 }
220 }
221
222 public String getName() {
223 return GetterUtil.getString(_name);
224 }
225
226 public void setName(String name) {
227 if (((name == null) && (_name != null)) ||
228 ((name != null) && (_name == null)) ||
229 ((name != null) && (_name != null) && !name.equals(_name))) {
230 _name = name;
231 }
232 }
233
234 public String getDescription() {
235 return GetterUtil.getString(_description);
236 }
237
238 public void setDescription(String description) {
239 if (((description == null) && (_description != null)) ||
240 ((description != null) && (_description == null)) ||
241 ((description != null) && (_description != null) &&
242 !description.equals(_description))) {
243 _description = description;
244 }
245 }
246
247 public Date getLastPostDate() {
248 return _lastPostDate;
249 }
250
251 public void setLastPostDate(Date lastPostDate) {
252 if (((lastPostDate == null) && (_lastPostDate != null)) ||
253 ((lastPostDate != null) && (_lastPostDate == null)) ||
254 ((lastPostDate != null) && (_lastPostDate != null) &&
255 !lastPostDate.equals(_lastPostDate))) {
256 _lastPostDate = lastPostDate;
257 }
258 }
259
260 public MBCategory toEscapedModel() {
261 if (isEscapedModel()) {
262 return (MBCategory)this;
263 }
264 else {
265 MBCategory model = new MBCategoryImpl();
266
267 model.setEscapedModel(true);
268
269 model.setUuid(Html.escape(getUuid()));
270 model.setCategoryId(getCategoryId());
271 model.setGroupId(getGroupId());
272 model.setCompanyId(getCompanyId());
273 model.setUserId(getUserId());
274 model.setUserName(Html.escape(getUserName()));
275 model.setCreateDate(getCreateDate());
276 model.setModifiedDate(getModifiedDate());
277 model.setParentCategoryId(getParentCategoryId());
278 model.setName(Html.escape(getName()));
279 model.setDescription(Html.escape(getDescription()));
280 model.setLastPostDate(getLastPostDate());
281
282 model = (MBCategory)Proxy.newProxyInstance(MBCategory.class.getClassLoader(),
283 new Class[] { MBCategory.class },
284 new ReadOnlyBeanHandler(model));
285
286 return model;
287 }
288 }
289
290 public Object clone() {
291 MBCategoryImpl clone = new MBCategoryImpl();
292
293 clone.setUuid(getUuid());
294 clone.setCategoryId(getCategoryId());
295 clone.setGroupId(getGroupId());
296 clone.setCompanyId(getCompanyId());
297 clone.setUserId(getUserId());
298 clone.setUserName(getUserName());
299 clone.setCreateDate(getCreateDate());
300 clone.setModifiedDate(getModifiedDate());
301 clone.setParentCategoryId(getParentCategoryId());
302 clone.setName(getName());
303 clone.setDescription(getDescription());
304 clone.setLastPostDate(getLastPostDate());
305
306 return clone;
307 }
308
309 public int compareTo(Object obj) {
310 if (obj == null) {
311 return -1;
312 }
313
314 MBCategoryImpl mbCategory = (MBCategoryImpl)obj;
315
316 int value = 0;
317
318 if (getParentCategoryId() < mbCategory.getParentCategoryId()) {
319 value = -1;
320 }
321 else if (getParentCategoryId() > mbCategory.getParentCategoryId()) {
322 value = 1;
323 }
324 else {
325 value = 0;
326 }
327
328 if (value != 0) {
329 return value;
330 }
331
332 value = getName().toLowerCase().compareTo(mbCategory.getName()
333 .toLowerCase());
334
335 if (value != 0) {
336 return value;
337 }
338
339 return 0;
340 }
341
342 public boolean equals(Object obj) {
343 if (obj == null) {
344 return false;
345 }
346
347 MBCategoryImpl mbCategory = null;
348
349 try {
350 mbCategory = (MBCategoryImpl)obj;
351 }
352 catch (ClassCastException cce) {
353 return false;
354 }
355
356 long pk = mbCategory.getPrimaryKey();
357
358 if (getPrimaryKey() == pk) {
359 return true;
360 }
361 else {
362 return false;
363 }
364 }
365
366 public int hashCode() {
367 return (int)getPrimaryKey();
368 }
369
370 private String _uuid;
371 private long _categoryId;
372 private long _groupId;
373 private long _companyId;
374 private long _userId;
375 private String _userName;
376 private Date _createDate;
377 private Date _modifiedDate;
378 private long _parentCategoryId;
379 private String _name;
380 private String _description;
381 private Date _lastPostDate;
382 }