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