1
22
23 package com.liferay.portlet.journal.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.impl.BaseModelImpl;
29 import com.liferay.portal.util.PropsUtil;
30
31 import com.liferay.portlet.journal.model.JournalTemplate;
32 import com.liferay.portlet.journal.model.JournalTemplateSoap;
33
34 import java.io.Serializable;
35
36 import java.lang.reflect.Proxy;
37
38 import java.sql.Types;
39
40 import java.util.ArrayList;
41 import java.util.Date;
42 import java.util.List;
43
44
64 public class JournalTemplateModelImpl extends BaseModelImpl {
65 public static final String TABLE_NAME = "JournalTemplate";
66 public static final Object[][] TABLE_COLUMNS = {
67 { "uuid_", new Integer(Types.VARCHAR) },
68
69
70 { "id_", new Integer(Types.BIGINT) },
71
72
73 { "groupId", new Integer(Types.BIGINT) },
74
75
76 { "companyId", new Integer(Types.BIGINT) },
77
78
79 { "userId", new Integer(Types.BIGINT) },
80
81
82 { "userName", new Integer(Types.VARCHAR) },
83
84
85 { "createDate", new Integer(Types.TIMESTAMP) },
86
87
88 { "modifiedDate", new Integer(Types.TIMESTAMP) },
89
90
91 { "templateId", new Integer(Types.VARCHAR) },
92
93
94 { "structureId", new Integer(Types.VARCHAR) },
95
96
97 { "name", new Integer(Types.VARCHAR) },
98
99
100 { "description", new Integer(Types.VARCHAR) },
101
102
103 { "xsl", new Integer(Types.CLOB) },
104
105
106 { "langType", new Integer(Types.VARCHAR) },
107
108
109 { "cacheable", new Integer(Types.BOOLEAN) },
110
111
112 { "smallImage", new Integer(Types.BOOLEAN) },
113
114
115 { "smallImageId", new Integer(Types.BIGINT) },
116
117
118 { "smallImageURL", new Integer(Types.VARCHAR) }
119 };
120 public static final String TABLE_SQL_CREATE = "create table JournalTemplate (uuid_ VARCHAR(75) null,id_ LONG not null primary key,groupId LONG,companyId LONG,userId LONG,userName VARCHAR(75) null,createDate DATE null,modifiedDate DATE null,templateId VARCHAR(75) null,structureId VARCHAR(75) null,name VARCHAR(75) null,description STRING null,xsl TEXT null,langType VARCHAR(75) null,cacheable BOOLEAN,smallImage BOOLEAN,smallImageId LONG,smallImageURL VARCHAR(75) null)";
121 public static final String TABLE_SQL_DROP = "drop table JournalTemplate";
122 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(PropsUtil.get(
123 "value.object.finder.cache.enabled.com.liferay.portlet.journal.model.JournalTemplate"),
124 true);
125
126 public static JournalTemplate toModel(JournalTemplateSoap soapModel) {
127 JournalTemplate model = new JournalTemplateImpl();
128
129 model.setUuid(soapModel.getUuid());
130 model.setId(soapModel.getId());
131 model.setGroupId(soapModel.getGroupId());
132 model.setCompanyId(soapModel.getCompanyId());
133 model.setUserId(soapModel.getUserId());
134 model.setUserName(soapModel.getUserName());
135 model.setCreateDate(soapModel.getCreateDate());
136 model.setModifiedDate(soapModel.getModifiedDate());
137 model.setTemplateId(soapModel.getTemplateId());
138 model.setStructureId(soapModel.getStructureId());
139 model.setName(soapModel.getName());
140 model.setDescription(soapModel.getDescription());
141 model.setXsl(soapModel.getXsl());
142 model.setLangType(soapModel.getLangType());
143 model.setCacheable(soapModel.getCacheable());
144 model.setSmallImage(soapModel.getSmallImage());
145 model.setSmallImageId(soapModel.getSmallImageId());
146 model.setSmallImageURL(soapModel.getSmallImageURL());
147
148 return model;
149 }
150
151 public static List<JournalTemplate> toModels(
152 JournalTemplateSoap[] soapModels) {
153 List<JournalTemplate> models = new ArrayList<JournalTemplate>(soapModels.length);
154
155 for (JournalTemplateSoap soapModel : soapModels) {
156 models.add(toModel(soapModel));
157 }
158
159 return models;
160 }
161
162 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(PropsUtil.get(
163 "lock.expiration.time.com.liferay.portlet.journal.model.JournalTemplate"));
164
165 public JournalTemplateModelImpl() {
166 }
167
168 public long getPrimaryKey() {
169 return _id;
170 }
171
172 public void setPrimaryKey(long pk) {
173 setId(pk);
174 }
175
176 public Serializable getPrimaryKeyObj() {
177 return new Long(_id);
178 }
179
180 public String getUuid() {
181 return GetterUtil.getString(_uuid);
182 }
183
184 public void setUuid(String uuid) {
185 if ((uuid != null) && (uuid != _uuid)) {
186 _uuid = uuid;
187 }
188 }
189
190 public long getId() {
191 return _id;
192 }
193
194 public void setId(long id) {
195 if (id != _id) {
196 _id = id;
197 }
198 }
199
200 public long getGroupId() {
201 return _groupId;
202 }
203
204 public void setGroupId(long groupId) {
205 if (groupId != _groupId) {
206 _groupId = groupId;
207 }
208 }
209
210 public long getCompanyId() {
211 return _companyId;
212 }
213
214 public void setCompanyId(long companyId) {
215 if (companyId != _companyId) {
216 _companyId = companyId;
217 }
218 }
219
220 public long getUserId() {
221 return _userId;
222 }
223
224 public void setUserId(long userId) {
225 if (userId != _userId) {
226 _userId = userId;
227 }
228 }
229
230 public String getUserName() {
231 return GetterUtil.getString(_userName);
232 }
233
234 public void setUserName(String userName) {
235 if (((userName == null) && (_userName != null)) ||
236 ((userName != null) && (_userName == null)) ||
237 ((userName != null) && (_userName != null) &&
238 !userName.equals(_userName))) {
239 _userName = userName;
240 }
241 }
242
243 public Date getCreateDate() {
244 return _createDate;
245 }
246
247 public void setCreateDate(Date createDate) {
248 if (((createDate == null) && (_createDate != null)) ||
249 ((createDate != null) && (_createDate == null)) ||
250 ((createDate != null) && (_createDate != null) &&
251 !createDate.equals(_createDate))) {
252 _createDate = createDate;
253 }
254 }
255
256 public Date getModifiedDate() {
257 return _modifiedDate;
258 }
259
260 public void setModifiedDate(Date modifiedDate) {
261 if (((modifiedDate == null) && (_modifiedDate != null)) ||
262 ((modifiedDate != null) && (_modifiedDate == null)) ||
263 ((modifiedDate != null) && (_modifiedDate != null) &&
264 !modifiedDate.equals(_modifiedDate))) {
265 _modifiedDate = modifiedDate;
266 }
267 }
268
269 public String getTemplateId() {
270 return GetterUtil.getString(_templateId);
271 }
272
273 public void setTemplateId(String templateId) {
274 if (((templateId == null) && (_templateId != null)) ||
275 ((templateId != null) && (_templateId == null)) ||
276 ((templateId != null) && (_templateId != null) &&
277 !templateId.equals(_templateId))) {
278 _templateId = templateId;
279 }
280 }
281
282 public String getStructureId() {
283 return GetterUtil.getString(_structureId);
284 }
285
286 public void setStructureId(String structureId) {
287 if (((structureId == null) && (_structureId != null)) ||
288 ((structureId != null) && (_structureId == null)) ||
289 ((structureId != null) && (_structureId != null) &&
290 !structureId.equals(_structureId))) {
291 _structureId = structureId;
292 }
293 }
294
295 public String getName() {
296 return GetterUtil.getString(_name);
297 }
298
299 public void setName(String name) {
300 if (((name == null) && (_name != null)) ||
301 ((name != null) && (_name == null)) ||
302 ((name != null) && (_name != null) && !name.equals(_name))) {
303 _name = name;
304 }
305 }
306
307 public String getDescription() {
308 return GetterUtil.getString(_description);
309 }
310
311 public void setDescription(String description) {
312 if (((description == null) && (_description != null)) ||
313 ((description != null) && (_description == null)) ||
314 ((description != null) && (_description != null) &&
315 !description.equals(_description))) {
316 _description = description;
317 }
318 }
319
320 public String getXsl() {
321 return GetterUtil.getString(_xsl);
322 }
323
324 public void setXsl(String xsl) {
325 if (((xsl == null) && (_xsl != null)) ||
326 ((xsl != null) && (_xsl == null)) ||
327 ((xsl != null) && (_xsl != null) && !xsl.equals(_xsl))) {
328 _xsl = xsl;
329 }
330 }
331
332 public String getLangType() {
333 return GetterUtil.getString(_langType);
334 }
335
336 public void setLangType(String langType) {
337 if (((langType == null) && (_langType != null)) ||
338 ((langType != null) && (_langType == null)) ||
339 ((langType != null) && (_langType != null) &&
340 !langType.equals(_langType))) {
341 _langType = langType;
342 }
343 }
344
345 public boolean getCacheable() {
346 return _cacheable;
347 }
348
349 public boolean isCacheable() {
350 return _cacheable;
351 }
352
353 public void setCacheable(boolean cacheable) {
354 if (cacheable != _cacheable) {
355 _cacheable = cacheable;
356 }
357 }
358
359 public boolean getSmallImage() {
360 return _smallImage;
361 }
362
363 public boolean isSmallImage() {
364 return _smallImage;
365 }
366
367 public void setSmallImage(boolean smallImage) {
368 if (smallImage != _smallImage) {
369 _smallImage = smallImage;
370 }
371 }
372
373 public long getSmallImageId() {
374 return _smallImageId;
375 }
376
377 public void setSmallImageId(long smallImageId) {
378 if (smallImageId != _smallImageId) {
379 _smallImageId = smallImageId;
380 }
381 }
382
383 public String getSmallImageURL() {
384 return GetterUtil.getString(_smallImageURL);
385 }
386
387 public void setSmallImageURL(String smallImageURL) {
388 if (((smallImageURL == null) && (_smallImageURL != null)) ||
389 ((smallImageURL != null) && (_smallImageURL == null)) ||
390 ((smallImageURL != null) && (_smallImageURL != null) &&
391 !smallImageURL.equals(_smallImageURL))) {
392 _smallImageURL = smallImageURL;
393 }
394 }
395
396 public JournalTemplate toEscapedModel() {
397 if (isEscapedModel()) {
398 return (JournalTemplate)this;
399 }
400 else {
401 JournalTemplate model = new JournalTemplateImpl();
402
403 model.setEscapedModel(true);
404
405 model.setUuid(HtmlUtil.escape(getUuid()));
406 model.setId(getId());
407 model.setGroupId(getGroupId());
408 model.setCompanyId(getCompanyId());
409 model.setUserId(getUserId());
410 model.setUserName(HtmlUtil.escape(getUserName()));
411 model.setCreateDate(getCreateDate());
412 model.setModifiedDate(getModifiedDate());
413 model.setTemplateId(getTemplateId());
414 model.setStructureId(getStructureId());
415 model.setName(HtmlUtil.escape(getName()));
416 model.setDescription(HtmlUtil.escape(getDescription()));
417 model.setXsl(HtmlUtil.escape(getXsl()));
418 model.setLangType(HtmlUtil.escape(getLangType()));
419 model.setCacheable(getCacheable());
420 model.setSmallImage(getSmallImage());
421 model.setSmallImageId(getSmallImageId());
422 model.setSmallImageURL(HtmlUtil.escape(getSmallImageURL()));
423
424 model = (JournalTemplate)Proxy.newProxyInstance(JournalTemplate.class.getClassLoader(),
425 new Class[] { JournalTemplate.class },
426 new ReadOnlyBeanHandler(model));
427
428 return model;
429 }
430 }
431
432 public Object clone() {
433 JournalTemplateImpl clone = new JournalTemplateImpl();
434
435 clone.setUuid(getUuid());
436 clone.setId(getId());
437 clone.setGroupId(getGroupId());
438 clone.setCompanyId(getCompanyId());
439 clone.setUserId(getUserId());
440 clone.setUserName(getUserName());
441 clone.setCreateDate(getCreateDate());
442 clone.setModifiedDate(getModifiedDate());
443 clone.setTemplateId(getTemplateId());
444 clone.setStructureId(getStructureId());
445 clone.setName(getName());
446 clone.setDescription(getDescription());
447 clone.setXsl(getXsl());
448 clone.setLangType(getLangType());
449 clone.setCacheable(getCacheable());
450 clone.setSmallImage(getSmallImage());
451 clone.setSmallImageId(getSmallImageId());
452 clone.setSmallImageURL(getSmallImageURL());
453
454 return clone;
455 }
456
457 public int compareTo(Object obj) {
458 if (obj == null) {
459 return -1;
460 }
461
462 JournalTemplateImpl journalTemplate = (JournalTemplateImpl)obj;
463
464 int value = 0;
465
466 value = getTemplateId().compareTo(journalTemplate.getTemplateId());
467
468 if (value != 0) {
469 return value;
470 }
471
472 return 0;
473 }
474
475 public boolean equals(Object obj) {
476 if (obj == null) {
477 return false;
478 }
479
480 JournalTemplateImpl journalTemplate = null;
481
482 try {
483 journalTemplate = (JournalTemplateImpl)obj;
484 }
485 catch (ClassCastException cce) {
486 return false;
487 }
488
489 long pk = journalTemplate.getPrimaryKey();
490
491 if (getPrimaryKey() == pk) {
492 return true;
493 }
494 else {
495 return false;
496 }
497 }
498
499 public int hashCode() {
500 return (int)getPrimaryKey();
501 }
502
503 private String _uuid;
504 private long _id;
505 private long _groupId;
506 private long _companyId;
507 private long _userId;
508 private String _userName;
509 private Date _createDate;
510 private Date _modifiedDate;
511 private String _templateId;
512 private String _structureId;
513 private String _name;
514 private String _description;
515 private String _xsl;
516 private String _langType;
517 private boolean _cacheable;
518 private boolean _smallImage;
519 private long _smallImageId;
520 private String _smallImageURL;
521 }