1
19
20 package com.liferay.portlet.journal.model.impl;
21
22 import com.liferay.portal.kernel.bean.ReadOnlyBeanHandler;
23 import com.liferay.portal.kernel.util.GetterUtil;
24 import com.liferay.portal.kernel.util.HtmlUtil;
25 import com.liferay.portal.model.impl.BaseModelImpl;
26
27 import com.liferay.portlet.journal.model.JournalTemplate;
28 import com.liferay.portlet.journal.model.JournalTemplateSoap;
29
30 import java.io.Serializable;
31
32 import java.lang.reflect.Proxy;
33
34 import java.sql.Types;
35
36 import java.util.ArrayList;
37 import java.util.Date;
38 import java.util.List;
39
40
60 public class JournalTemplateModelImpl extends BaseModelImpl {
61 public static final String TABLE_NAME = "JournalTemplate";
62 public static final Object[][] TABLE_COLUMNS = {
63 { "uuid_", new Integer(Types.VARCHAR) },
64
65
66 { "id_", new Integer(Types.BIGINT) },
67
68
69 { "groupId", new Integer(Types.BIGINT) },
70
71
72 { "companyId", new Integer(Types.BIGINT) },
73
74
75 { "userId", new Integer(Types.BIGINT) },
76
77
78 { "userName", new Integer(Types.VARCHAR) },
79
80
81 { "createDate", new Integer(Types.TIMESTAMP) },
82
83
84 { "modifiedDate", new Integer(Types.TIMESTAMP) },
85
86
87 { "templateId", new Integer(Types.VARCHAR) },
88
89
90 { "structureId", new Integer(Types.VARCHAR) },
91
92
93 { "name", new Integer(Types.VARCHAR) },
94
95
96 { "description", new Integer(Types.VARCHAR) },
97
98
99 { "xsl", new Integer(Types.CLOB) },
100
101
102 { "langType", new Integer(Types.VARCHAR) },
103
104
105 { "cacheable", new Integer(Types.BOOLEAN) },
106
107
108 { "smallImage", new Integer(Types.BOOLEAN) },
109
110
111 { "smallImageId", new Integer(Types.BIGINT) },
112
113
114 { "smallImageURL", new Integer(Types.VARCHAR) }
115 };
116 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)";
117 public static final String TABLE_SQL_DROP = "drop table JournalTemplate";
118 public static final String DATA_SOURCE = "liferayDataSource";
119 public static final String SESSION_FACTORY = "liferaySessionFactory";
120 public static final String TX_MANAGER = "liferayTransactionManager";
121 public static final boolean CACHE_ENABLED = GetterUtil.getBoolean(com.liferay.portal.util.PropsUtil.get(
122 "value.object.finder.cache.enabled.com.liferay.portlet.journal.model.JournalTemplate"),
123 true);
124
125 public static JournalTemplate toModel(JournalTemplateSoap soapModel) {
126 JournalTemplate model = new JournalTemplateImpl();
127
128 model.setUuid(soapModel.getUuid());
129 model.setId(soapModel.getId());
130 model.setGroupId(soapModel.getGroupId());
131 model.setCompanyId(soapModel.getCompanyId());
132 model.setUserId(soapModel.getUserId());
133 model.setUserName(soapModel.getUserName());
134 model.setCreateDate(soapModel.getCreateDate());
135 model.setModifiedDate(soapModel.getModifiedDate());
136 model.setTemplateId(soapModel.getTemplateId());
137 model.setStructureId(soapModel.getStructureId());
138 model.setName(soapModel.getName());
139 model.setDescription(soapModel.getDescription());
140 model.setXsl(soapModel.getXsl());
141 model.setLangType(soapModel.getLangType());
142 model.setCacheable(soapModel.getCacheable());
143 model.setSmallImage(soapModel.getSmallImage());
144 model.setSmallImageId(soapModel.getSmallImageId());
145 model.setSmallImageURL(soapModel.getSmallImageURL());
146
147 return model;
148 }
149
150 public static List<JournalTemplate> toModels(
151 JournalTemplateSoap[] soapModels) {
152 List<JournalTemplate> models = new ArrayList<JournalTemplate>(soapModels.length);
153
154 for (JournalTemplateSoap soapModel : soapModels) {
155 models.add(toModel(soapModel));
156 }
157
158 return models;
159 }
160
161 public static final long LOCK_EXPIRATION_TIME = GetterUtil.getLong(com.liferay.portal.util.PropsUtil.get(
162 "lock.expiration.time.com.liferay.portlet.journal.model.JournalTemplate"));
163
164 public JournalTemplateModelImpl() {
165 }
166
167 public long getPrimaryKey() {
168 return _id;
169 }
170
171 public void setPrimaryKey(long pk) {
172 setId(pk);
173 }
174
175 public Serializable getPrimaryKeyObj() {
176 return new Long(_id);
177 }
178
179 public String getUuid() {
180 return GetterUtil.getString(_uuid);
181 }
182
183 public void setUuid(String uuid) {
184 if ((uuid != null) && (uuid != _uuid)) {
185 _uuid = uuid;
186 }
187 }
188
189 public long getId() {
190 return _id;
191 }
192
193 public void setId(long id) {
194 if (id != _id) {
195 _id = id;
196 }
197 }
198
199 public long getGroupId() {
200 return _groupId;
201 }
202
203 public void setGroupId(long groupId) {
204 if (groupId != _groupId) {
205 _groupId = groupId;
206 }
207 }
208
209 public long getCompanyId() {
210 return _companyId;
211 }
212
213 public void setCompanyId(long companyId) {
214 if (companyId != _companyId) {
215 _companyId = companyId;
216 }
217 }
218
219 public long getUserId() {
220 return _userId;
221 }
222
223 public void setUserId(long userId) {
224 if (userId != _userId) {
225 _userId = userId;
226 }
227 }
228
229 public String getUserName() {
230 return GetterUtil.getString(_userName);
231 }
232
233 public void setUserName(String userName) {
234 if (((userName == null) && (_userName != null)) ||
235 ((userName != null) && (_userName == null)) ||
236 ((userName != null) && (_userName != null) &&
237 !userName.equals(_userName))) {
238 _userName = userName;
239 }
240 }
241
242 public Date getCreateDate() {
243 return _createDate;
244 }
245
246 public void setCreateDate(Date createDate) {
247 if (((createDate == null) && (_createDate != null)) ||
248 ((createDate != null) && (_createDate == null)) ||
249 ((createDate != null) && (_createDate != null) &&
250 !createDate.equals(_createDate))) {
251 _createDate = createDate;
252 }
253 }
254
255 public Date getModifiedDate() {
256 return _modifiedDate;
257 }
258
259 public void setModifiedDate(Date modifiedDate) {
260 if (((modifiedDate == null) && (_modifiedDate != null)) ||
261 ((modifiedDate != null) && (_modifiedDate == null)) ||
262 ((modifiedDate != null) && (_modifiedDate != null) &&
263 !modifiedDate.equals(_modifiedDate))) {
264 _modifiedDate = modifiedDate;
265 }
266 }
267
268 public String getTemplateId() {
269 return GetterUtil.getString(_templateId);
270 }
271
272 public void setTemplateId(String templateId) {
273 if (((templateId == null) && (_templateId != null)) ||
274 ((templateId != null) && (_templateId == null)) ||
275 ((templateId != null) && (_templateId != null) &&
276 !templateId.equals(_templateId))) {
277 _templateId = templateId;
278 }
279 }
280
281 public String getStructureId() {
282 return GetterUtil.getString(_structureId);
283 }
284
285 public void setStructureId(String structureId) {
286 if (((structureId == null) && (_structureId != null)) ||
287 ((structureId != null) && (_structureId == null)) ||
288 ((structureId != null) && (_structureId != null) &&
289 !structureId.equals(_structureId))) {
290 _structureId = structureId;
291 }
292 }
293
294 public String getName() {
295 return GetterUtil.getString(_name);
296 }
297
298 public void setName(String name) {
299 if (((name == null) && (_name != null)) ||
300 ((name != null) && (_name == null)) ||
301 ((name != null) && (_name != null) && !name.equals(_name))) {
302 _name = name;
303 }
304 }
305
306 public String getDescription() {
307 return GetterUtil.getString(_description);
308 }
309
310 public void setDescription(String description) {
311 if (((description == null) && (_description != null)) ||
312 ((description != null) && (_description == null)) ||
313 ((description != null) && (_description != null) &&
314 !description.equals(_description))) {
315 _description = description;
316 }
317 }
318
319 public String getXsl() {
320 return GetterUtil.getString(_xsl);
321 }
322
323 public void setXsl(String xsl) {
324 if (((xsl == null) && (_xsl != null)) ||
325 ((xsl != null) && (_xsl == null)) ||
326 ((xsl != null) && (_xsl != null) && !xsl.equals(_xsl))) {
327 _xsl = xsl;
328 }
329 }
330
331 public String getLangType() {
332 return GetterUtil.getString(_langType);
333 }
334
335 public void setLangType(String langType) {
336 if (((langType == null) && (_langType != null)) ||
337 ((langType != null) && (_langType == null)) ||
338 ((langType != null) && (_langType != null) &&
339 !langType.equals(_langType))) {
340 _langType = langType;
341 }
342 }
343
344 public boolean getCacheable() {
345 return _cacheable;
346 }
347
348 public boolean isCacheable() {
349 return _cacheable;
350 }
351
352 public void setCacheable(boolean cacheable) {
353 if (cacheable != _cacheable) {
354 _cacheable = cacheable;
355 }
356 }
357
358 public boolean getSmallImage() {
359 return _smallImage;
360 }
361
362 public boolean isSmallImage() {
363 return _smallImage;
364 }
365
366 public void setSmallImage(boolean smallImage) {
367 if (smallImage != _smallImage) {
368 _smallImage = smallImage;
369 }
370 }
371
372 public long getSmallImageId() {
373 return _smallImageId;
374 }
375
376 public void setSmallImageId(long smallImageId) {
377 if (smallImageId != _smallImageId) {
378 _smallImageId = smallImageId;
379 }
380 }
381
382 public String getSmallImageURL() {
383 return GetterUtil.getString(_smallImageURL);
384 }
385
386 public void setSmallImageURL(String smallImageURL) {
387 if (((smallImageURL == null) && (_smallImageURL != null)) ||
388 ((smallImageURL != null) && (_smallImageURL == null)) ||
389 ((smallImageURL != null) && (_smallImageURL != null) &&
390 !smallImageURL.equals(_smallImageURL))) {
391 _smallImageURL = smallImageURL;
392 }
393 }
394
395 public JournalTemplate toEscapedModel() {
396 if (isEscapedModel()) {
397 return (JournalTemplate)this;
398 }
399 else {
400 JournalTemplate model = new JournalTemplateImpl();
401
402 model.setNew(isNew());
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 }